LUCENE-1614: if a DISI doesn't implement advance, emulate it using skipTo

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@794399 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-07-15 20:21:53 +00:00
parent 229a0a84a1
commit d7579b7e1e
1 changed files with 4 additions and 2 deletions

View File

@ -142,8 +142,10 @@ public abstract class DocIdSetIterator {
* @since 2.9
*/
public int advance(int target) throws IOException {
while (nextDoc() < target) {}
return doc;
if (target == NO_MORE_DOCS) {
return doc = NO_MORE_DOCS;
}
return doc = skipTo(target) ? doc() : NO_MORE_DOCS;
}
}