mirror of https://github.com/apache/lucene.git
LUCENE-6022: DocValuesDocIdSet checks live docs before doc values.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1633879 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad9fb9a9dd
commit
62ed868f2a
|
@ -243,6 +243,9 @@ Optimizations
|
|||
* LUCENE-5983: CachingWrapperFilter now uses a new DocIdSet implementation
|
||||
called RoaringDocIdSet instead of WAH8DocIdSet. (Adrien Grand)
|
||||
|
||||
* LUCENE-6022: DocValuesDocIdSet checks live docs before doc values.
|
||||
(Adrien Grand)
|
||||
|
||||
Build
|
||||
|
||||
* LUCENE-5909: Smoke tester now has better command line parsing and
|
||||
|
|
|
@ -27,8 +27,7 @@ import org.apache.lucene.util.FixedBitSet;
|
|||
* of its iterator is very stupid and slow if the implementation of the
|
||||
* {@link #matchDoc} method is not optimized, as iterators simply increment
|
||||
* the document id until {@code matchDoc(int)} returns true. Because of this
|
||||
* {@code matchDoc(int)} must be as fast as possible and in no case do any
|
||||
* I/O.
|
||||
* {@code matchDoc(int)} must be as fast as possible.
|
||||
* @lucene.internal
|
||||
*/
|
||||
public abstract class DocValuesDocIdSet extends DocIdSet {
|
||||
|
@ -66,7 +65,7 @@ public abstract class DocValuesDocIdSet extends DocIdSet {
|
|||
} : new Bits() {
|
||||
@Override
|
||||
public boolean get(int docid) {
|
||||
return matchDoc(docid) && acceptDocs.get(docid);
|
||||
return acceptDocs.get(docid) && matchDoc(docid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,19 +134,13 @@ public abstract class DocValuesDocIdSet extends DocIdSet {
|
|||
|
||||
@Override
|
||||
public int nextDoc() {
|
||||
do {
|
||||
doc++;
|
||||
if (doc >= maxDoc) {
|
||||
return doc = NO_MORE_DOCS;
|
||||
}
|
||||
} while (!(matchDoc(doc) && acceptDocs.get(doc)));
|
||||
return doc;
|
||||
return advance(doc + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int advance(int target) {
|
||||
for(doc=target; doc<maxDoc; doc++) {
|
||||
if (matchDoc(doc) && acceptDocs.get(doc)) {
|
||||
if (acceptDocs.get(doc) && matchDoc(doc)) {
|
||||
return doc;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue