Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Remove awaits fix for ApproximatePointRangeQuery tests #15871

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.LongPoint;
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.TotalHits;
import org.apache.lucene.store.Directory;
Expand All @@ -26,6 +29,7 @@

import java.io.IOException;

import static java.util.Arrays.asList;
import static org.apache.lucene.document.LongPoint.pack;
import static org.mockito.Mockito.mock;

Expand Down Expand Up @@ -253,8 +257,7 @@ public void testApproximateRangeShortCircuitAscSort() throws IOException {
for (int v = 0; v < dims; v++) {
scratch[v] = i;
}
doc.add(new LongPoint("point", scratch));
iw.addDocument(doc);
iw.addDocument(asList(new LongPoint("point", scratch[0]), new NumericDocValuesField("point", scratch[0])));
}
iw.flush();
iw.forceMerge(1);
Expand All @@ -277,8 +280,9 @@ protected String toString(int dimension, byte[] value) {
Query query = LongPoint.newRangeQuery("point", lower, upper);
;
IndexSearcher searcher = new IndexSearcher(reader);
TopDocs topDocs = searcher.search(approximateQuery, 10);
TopDocs topDocs1 = searcher.search(query, 10);
Sort sort = new Sort(new SortField("point", SortField.Type.LONG));
TopDocs topDocs = searcher.search(approximateQuery, 10, sort);
TopDocs topDocs1 = searcher.search(query, 10, sort);

// since we short-circuit from the approx range at the end of size these will not be equal
assertNotEquals(topDocs.totalHits, topDocs1.totalHits);
Expand Down
Loading