class ParallelReader.ParallelTermEnum {
public boolean next() throws IOException {
if (termEnum==null)
return false;
// another term in this field?
if (termEnum.next() && termEnum.term().field()==field)
return true; // yes, keep going
termEnum.close(); // close old termEnum
// find the next field with terms, if any
if (fieldIterator==null) {
fieldIterator = fieldToReader.tailMap(field).keySet().iterator();
fieldIterator.next(); // Skip field to get next one
}
while (fieldIterator.hasNext()) {
field = (String) fieldIterator.next();
termEnum = ((IndexReader)fieldToReader.get(field)).terms(new Term(field));
Term term = termEnum.term();
if (term!=null && term.field()==field)
return true;
else
termEnum.close();
}
return false; // no more fields
}
}
class ParallelReader.ParallelTermDocs {
public boolean next() throws IOException {
if (termDocs==null)
return false;
return termDocs.next();
}
}