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