Skip to content

Commit 7cb2bd0

Browse files
authored
Remove awaits fix since tests are now passing (opensearch-project#15727)
Signed-off-by: Harsha Vamsi Kalluri <harshavamsi096@gmail.com>
1 parent e688d39 commit 7cb2bd0

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

server/src/test/java/org/opensearch/search/approximate/ApproximatePointRangeQueryTests.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@
1313
import org.apache.lucene.analysis.core.WhitespaceAnalyzer;
1414
import org.apache.lucene.document.Document;
1515
import org.apache.lucene.document.LongPoint;
16+
import org.apache.lucene.document.NumericDocValuesField;
1617
import org.apache.lucene.index.IndexReader;
1718
import org.apache.lucene.search.IndexSearcher;
1819
import org.apache.lucene.search.Query;
20+
import org.apache.lucene.search.Sort;
21+
import org.apache.lucene.search.SortField;
1922
import org.apache.lucene.search.TopDocs;
2023
import org.apache.lucene.search.TotalHits;
2124
import org.apache.lucene.store.Directory;
@@ -26,6 +29,7 @@
2629

2730
import java.io.IOException;
2831

32+
import static java.util.Arrays.asList;
2933
import static org.apache.lucene.document.LongPoint.pack;
3034
import static org.mockito.Mockito.mock;
3135

@@ -112,7 +116,6 @@ protected String toString(int dimension, byte[] value) {
112116
}
113117
}
114118

115-
@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/15600")
116119
public void testApproximateRangeWithSizeUnderDefault() throws IOException {
117120
try (Directory directory = newDirectory()) {
118121
try (RandomIndexWriter iw = new RandomIndexWriter(random(), directory, new WhitespaceAnalyzer())) {
@@ -151,7 +154,6 @@ protected String toString(int dimension, byte[] value) {
151154
}
152155
}
153156

154-
@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/15600")
155157
public void testApproximateRangeWithSizeOverDefault() throws IOException {
156158
try (Directory directory = newDirectory()) {
157159
try (RandomIndexWriter iw = new RandomIndexWriter(random(), directory, new WhitespaceAnalyzer())) {
@@ -196,7 +198,6 @@ protected String toString(int dimension, byte[] value) {
196198
}
197199
}
198200

199-
@AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/15600")
200201
public void testApproximateRangeShortCircuit() throws IOException {
201202
try (Directory directory = newDirectory()) {
202203
try (RandomIndexWriter iw = new RandomIndexWriter(random(), directory, new WhitespaceAnalyzer())) {
@@ -256,8 +257,7 @@ public void testApproximateRangeShortCircuitAscSort() throws IOException {
256257
for (int v = 0; v < dims; v++) {
257258
scratch[v] = i;
258259
}
259-
doc.add(new LongPoint("point", scratch));
260-
iw.addDocument(doc);
260+
iw.addDocument(asList(new LongPoint("point", scratch[0]), new NumericDocValuesField("point", scratch[0])));
261261
}
262262
iw.flush();
263263
iw.forceMerge(1);
@@ -280,8 +280,9 @@ protected String toString(int dimension, byte[] value) {
280280
Query query = LongPoint.newRangeQuery("point", lower, upper);
281281
;
282282
IndexSearcher searcher = new IndexSearcher(reader);
283-
TopDocs topDocs = searcher.search(approximateQuery, 10);
284-
TopDocs topDocs1 = searcher.search(query, 10);
283+
Sort sort = new Sort(new SortField("point", SortField.Type.LONG));
284+
TopDocs topDocs = searcher.search(approximateQuery, 10, sort);
285+
TopDocs topDocs1 = searcher.search(query, 10, sort);
285286

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

0 commit comments

Comments
 (0)