make MultiTermDocs.skipTo use sub TermDocs.skipTo: LUCENE-586

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@410941 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2006-06-01 20:33:18 +00:00
parent 2008f5c535
commit 4944720897
2 changed files with 15 additions and 5 deletions

View File

@ -14,6 +14,13 @@ Bug fixes
didn't work because it used a QueryParser method that had
been removed (Daniel Naber)
Optimizations
1. LUCENE-586: TermDocs.skipTo() is now more efficient for multi-segment
indexes. This will improve the performance of many types of queries
against a non-optimized index. (Andrew Hudson via Yonik Seeley)
Release 2.0.0 2005-05-26

View File

@ -374,13 +374,16 @@ class MultiTermDocs implements TermDocs {
}
}
/** As yet unoptimized implementation. */
/* A Possible future optimization could skip entire segments */
public boolean skipTo(int target) throws IOException {
do {
if (!next())
return false;
} while (target > doc());
if (current != null && current.skipTo(target-base)) {
return true;
} else if (pointer < readers.length) {
base = starts[pointer];
current = termDocs(pointer++);
return skipTo(target);
} else
return false;
}
private TermDocs termDocs(int i) throws IOException {