Skip to content

Commit a93df5b

Browse files
ergunkezer1ergun-kezer
authored andcommitted
fix: testJVectorKnnIndex_filter_maxInnerProduct test (#688)
Signed-off-by: ergun-kezer <ergun.kezer@ibm.com> Co-authored-by: ergun-kezer <ergun.kezer@ibm.com> (cherry picked from commit be0ed0a) Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
1 parent 949af2c commit a93df5b

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1010
### Enhancements
1111

1212
### Bug Fixes
13+
- Fix flaky testJVectorKnnIndex_filter_maxInnerProduct test case [681](https://github.com/opensearch-project/opensearch-jvector/pull/681)
1314

1415
### Infrastructure
1516
### Documentation

src/test/java/org/opensearch/knn/index/codec/jvector/KNNJVectorTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public void testJVectorKnnIndex_filter_maxInnerProduct() throws IOException {
216216
indexWriterConfig.setUseCompoundFile(false);
217217
indexWriterConfig.setCodec(getCodec(random().nextBoolean()));
218218
indexWriterConfig.setMergePolicy(new ForceMergesOnlyMergePolicy());
219+
indexWriterConfig.setMaxBufferedDocs(totalNumberOfDocs);
219220
final Path indexPath = createTempDir();
220221
log.info("Index path: {}", indexPath);
221222
try (FSDirectory dir = FSDirectory.open(indexPath); IndexWriter w = new IndexWriter(dir, indexWriterConfig)) {
@@ -231,7 +232,8 @@ public void testJVectorKnnIndex_filter_maxInnerProduct() throws IOException {
231232
w.commit();
232233

233234
try (IndexReader reader = DirectoryReader.open(w)) {
234-
log.info("We should now have a single segment with 10 documents");
235+
log.info("We should now have a single segment with {} documents", totalNumberOfDocs);
236+
235237
Assert.assertEquals(1, reader.getContext().leaves().size());
236238
Assert.assertEquals(totalNumberOfDocs, reader.numDocs());
237239

0 commit comments

Comments
 (0)