fix caching on Mike's last commit. Also remove counting at all.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1025978 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2010-10-21 12:51:06 +00:00
parent b0f24be337
commit 2f2c4fe1a2
1 changed files with 4 additions and 9 deletions

View File

@ -247,10 +247,9 @@ public abstract class MultiTermQuery extends Query {
private abstract static class BooleanQueryRewrite extends RewriteMethod {
protected final int collectTerms(IndexReader reader, MultiTermQuery query, TermCollector collector) throws IOException {
protected final void collectTerms(IndexReader reader, MultiTermQuery query, TermCollector collector) throws IOException {
final List<IndexReader> subReaders = new ArrayList<IndexReader>();
ReaderUtil.gatherSubReaders(subReaders, reader);
int count = 0;
Comparator<BytesRef> lastTermComp = null;
for (IndexReader r : subReaders) {
@ -281,16 +280,12 @@ public abstract class MultiTermQuery extends Query {
collector.setNextEnum(termsEnum);
BytesRef bytes;
while ((bytes = termsEnum.next()) != null) {
if (collector.collect(bytes)) {
termsEnum.cacheCurrentTerm();
count++;
} else {
return count; // interrupt whole term collection, so also don't iterate other subReaders
if (!collector.collect(bytes))
return; // interrupt whole term collection, so also don't iterate other subReaders
}
}
}
return count;
}
protected static abstract class TermCollector {
/** attributes used for communication with the enum */