@@ -127,9 +127,9 @@ public void testApproximateRangeWithSizeUnderDefault() throws IOException {
127
127
}
128
128
doc .add (new LongPoint ("point" , scratch ));
129
129
iw .addDocument (doc );
130
- if (i % 15 == 0 ) iw .flush ();
131
130
}
132
131
iw .flush ();
132
+ iw .forceMerge (1 );
133
133
try (IndexReader reader = iw .getReader ()) {
134
134
try {
135
135
long lower = 0 ;
@@ -168,6 +168,7 @@ public void testApproximateRangeWithSizeOverDefault() throws IOException {
168
168
iw .addDocument (doc );
169
169
}
170
170
iw .flush ();
171
+ iw .forceMerge (1 );
171
172
try (IndexReader reader = iw .getReader ()) {
172
173
try {
173
174
long lower = 0 ;
@@ -185,7 +186,7 @@ protected String toString(int dimension, byte[] value) {
185
186
};
186
187
IndexSearcher searcher = new IndexSearcher (reader );
187
188
TopDocs topDocs = searcher .search (approximateQuery , 11000 );
188
- assertEquals (topDocs .totalHits , new TotalHits (11001 , TotalHits .Relation .GREATER_THAN_OR_EQUAL_TO ));
189
+ assertEquals (topDocs .totalHits , new TotalHits (11000 , TotalHits .Relation .EQUAL_TO ));
189
190
} catch (IOException e ) {
190
191
throw new RuntimeException (e );
191
192
}
@@ -213,6 +214,7 @@ public void testApproximateRangeShortCircuit() throws IOException {
213
214
if (i % 10 == 0 ) iw .flush ();
214
215
}
215
216
iw .flush ();
217
+ iw .forceMerge (1 );
216
218
try (IndexReader reader = iw .getReader ()) {
217
219
try {
218
220
long lower = 0 ;
@@ -258,6 +260,7 @@ public void testApproximateRangeShortCircuitAscSort() throws IOException {
258
260
iw .addDocument (doc );
259
261
}
260
262
iw .flush ();
263
+ iw .forceMerge (1 );
261
264
try (IndexReader reader = iw .getReader ()) {
262
265
try {
263
266
long lower = 0 ;
@@ -284,12 +287,12 @@ protected String toString(int dimension, byte[] value) {
284
287
assertNotEquals (topDocs .totalHits , topDocs1 .totalHits );
285
288
assertEquals (topDocs .totalHits , new TotalHits (10 , TotalHits .Relation .EQUAL_TO ));
286
289
assertEquals (topDocs1 .totalHits , new TotalHits (21 , TotalHits .Relation .EQUAL_TO ));
287
- assertEquals (topDocs .scoreDocs [0 ].doc , 0 );
288
- assertEquals (topDocs .scoreDocs [1 ].doc , 1 );
289
- assertEquals (topDocs .scoreDocs [2 ].doc , 2 );
290
- assertEquals (topDocs .scoreDocs [3 ].doc , 3 );
291
- assertEquals (topDocs .scoreDocs [4 ].doc , 4 );
292
- assertEquals (topDocs .scoreDocs [5 ].doc , 5 );
290
+ assertEquals (topDocs .scoreDocs [0 ].doc , topDocs1 . scoreDocs [ 0 ]. doc );
291
+ assertEquals (topDocs .scoreDocs [1 ].doc , topDocs1 . scoreDocs [ 1 ]. doc );
292
+ assertEquals (topDocs .scoreDocs [2 ].doc , topDocs1 . scoreDocs [ 2 ]. doc );
293
+ assertEquals (topDocs .scoreDocs [3 ].doc , topDocs1 . scoreDocs [ 3 ]. doc );
294
+ assertEquals (topDocs .scoreDocs [4 ].doc , topDocs1 . scoreDocs [ 4 ]. doc );
295
+ assertEquals (topDocs .scoreDocs [5 ].doc , topDocs1 . scoreDocs [ 5 ]. doc );
293
296
294
297
} catch (IOException e ) {
295
298
throw new RuntimeException (e );
0 commit comments