codaitya commented on a change in pull request #2214: URL: https://github.com/apache/lucene-solr/pull/2214#discussion_r560718191
########## File path: lucene/core/src/test/org/apache/lucene/index/TestVectorValues.java ########## @@ -815,4 +816,47 @@ public void testSearchStrategyIdentifiers() { assertEquals(2, VectorValues.SearchStrategy.DOT_PRODUCT_HNSW.ordinal()); assertEquals(3, VectorValues.SearchStrategy.values().length); } + + public void testAdvance() throws Exception { + try (Directory dir = newDirectory()) { + try (IndexWriter w = new IndexWriter(dir, createIndexWriterConfig())) { + int numdocs = 2000; + String fieldName = "field"; + for (int i = 0; i < numdocs; i++) { + Document doc = new Document(); + // randomly add a vector field + if (random().nextInt(4) == 3) { + doc.add( + new VectorField( + fieldName, new float[4], VectorValues.SearchStrategy.DOT_PRODUCT_HNSW)); + } + w.addDocument(doc); + } + w.forceMerge(1); + try (IndexReader reader = w.getReader()) { + LeafReader r = getOnlyLeafReader(reader); + VectorValues vectorValues = r.getVectorValues(fieldName); + TreeSet<Integer> vectorDocs = new TreeSet<>(); Review comment: We might need to advance the index by more than 1 sometimes ? But I can also do that with an array since it's always increasing. I will update to use array instead of TreeSet. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org