mirror of https://github.com/apache/lucene.git
LUCENE-9501: Fix invariant violation in IndexSortSortedNumericDocValuesRangeQuery. (#1833)
Previously the DocIdSetIterator returned an old value for docID advance returned NO_MORE_DOCS. This violates the DocIdSetIterator contract and made it possiblefor the iterator's advance method to be called even after it was already exhausted.
This commit is contained in:
parent
0250978869
commit
37e4dbef6d
|
@ -239,6 +239,9 @@ Bug Fixes
|
||||||
already exists instead of opening an IndexInput on the file which might throw a AccessDeniedException
|
already exists instead of opening an IndexInput on the file which might throw a AccessDeniedException
|
||||||
in some Directory implementations. (Simon Willnauer)
|
in some Directory implementations. (Simon Willnauer)
|
||||||
|
|
||||||
|
* LUCENE-9501: Fix a bug in IndexSortSortedNumericDocValuesRangeQuery where it could violate the
|
||||||
|
DocIdSetIterator contract. (Julie Tibshirani)
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -287,10 +287,10 @@ public class IndexSortSortedNumericDocValuesRangeQuery extends Query {
|
||||||
int result = delegate.advance(target);
|
int result = delegate.advance(target);
|
||||||
if (result < lastDoc) {
|
if (result < lastDoc) {
|
||||||
docID = result;
|
docID = result;
|
||||||
return docID;
|
|
||||||
} else {
|
} else {
|
||||||
return NO_MORE_DOCS;
|
docID = NO_MORE_DOCS;
|
||||||
}
|
}
|
||||||
|
return docID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class TestIndexSortSortedNumericDocValuesRangeQuery extends LuceneTestCas
|
||||||
iw.deleteDocuments(LongPoint.newRangeQuery("idx", 0L, 10L));
|
iw.deleteDocuments(LongPoint.newRangeQuery("idx", 0L, 10L));
|
||||||
}
|
}
|
||||||
final IndexReader reader = iw.getReader();
|
final IndexReader reader = iw.getReader();
|
||||||
final IndexSearcher searcher = newSearcher(reader, false);
|
final IndexSearcher searcher = newSearcher(reader);
|
||||||
iw.close();
|
iw.close();
|
||||||
|
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue