LUCENE-10592 Strengthen TestHnswGraph::testSortedAndUnsortedIndicesReturnSameResults

This test occasionally fails if knn search returns only 1 document
in the index, as we have an assertion that returned doc IDs from
sorted and unsorted index must be different.

This patch ensures that we have many documents in the index, so
that knn search always returns enough results.
This commit is contained in:
Mayya Sharipova 2022-07-25 09:41:51 -04:00
parent f943a57ebe
commit 2efc204a39
1 changed files with 1 additions and 2 deletions

View File

@ -134,7 +134,7 @@ public class TestHnswGraph extends LuceneTestCase {
// test that sorted index returns the same search results are unsorted
public void testSortedAndUnsortedIndicesReturnSameResults() throws IOException {
int dim = random().nextInt(10) + 3;
int nDoc = random().nextInt(500) + 1;
int nDoc = random().nextInt(200) + 100;
RandomVectorValues vectors = new RandomVectorValues(nDoc, dim, random());
int M = random().nextInt(10) + 5;
@ -163,7 +163,6 @@ public class TestHnswGraph extends LuceneTestCase {
}
})
.setIndexSort(new Sort(new SortField("sortkey", SortField.Type.LONG)));
;
try (Directory dir = newDirectory();
Directory dir2 = newDirectory()) {