}
for (Term startTerm : startTerms) {
TermEnum terms = reader.terms(startTerm);
try {
TermDocs docs = reader.termDocs();
try {
do {
Term term = terms.term();
if (term != null && term.field() == testField && term.text().startsWith(namePrefix)) {
if (checkLower) {
int compare = termCompare(term.text(), lowerTerm.text(), propNameLength);
if (compare > 0 || compare == 0 && inclusive) {
// do not check lower term anymore if no
// transformation is done on the term enum
checkLower = transform != TRANSFORM_NONE;
} else {
// continue with next term
continue;
}
}
if (upperTerm != null) {
int compare = termCompare(term.text(), upperTerm.text(), propNameLength);
// if beyond the upper term, or is exclusive and
// this is equal to the upper term
if ((compare > 0) || (!inclusive && compare == 0)) {
// only break out if no transformation
// was done on the term from the enum
if (transform == TRANSFORM_NONE) {
break;
} else {
// because of the transformation
// it is possible that the next
// term will be included again if
// we still enumerate on the same
// property name
if (term.text().startsWith(namePrefix)) {
continue;
} else {
break;
}
}
}
}
docs.seek(terms);
while (docs.next()) {
hits.set(docs.doc());
}
} else {
break;
}
} while (terms.next());
} finally {
docs.close();
}
} finally {
terms.close();
}
}