alessandrobenedetti commented on code in PR #926: URL: https://github.com/apache/lucene/pull/926#discussion_r885641501
########## lucene/core/src/test/org/apache/lucene/search/TestKnnVectorQuery.java: ########## @@ -193,25 +204,36 @@ public void testAdvanceShallow() throws IOException { } try (IndexReader reader = DirectoryReader.open(d)) { IndexSearcher searcher = new IndexSearcher(reader); - KnnVectorQuery query = new KnnVectorQuery("field", new float[] {2, 3}, 3); + KnnVectorQuery query = new KnnVectorQuery("field", new float[] {0.5f, 1}, 3); Query dasq = query.rewrite(reader); Scorer scorer = dasq.createWeight(searcher, ScoreMode.COMPLETE, 1).scorer(reader.leaves().get(0)); // before advancing the iterator - assertEquals(1, scorer.advanceShallow(0)); + assertEquals(0, scorer.advanceShallow(0)); assertEquals(1, scorer.advanceShallow(1)); assertEquals(NO_MORE_DOCS, scorer.advanceShallow(10)); // after advancing the iterator scorer.iterator().advance(2); assertEquals(2, scorer.advanceShallow(0)); + assertEquals(2, scorer.advanceShallow(1)); assertEquals(2, scorer.advanceShallow(2)); - assertEquals(3, scorer.advanceShallow(3)); assertEquals(NO_MORE_DOCS, scorer.advanceShallow(10)); } } } + /** + * Query = (0.5, 1) + * Doc0 = (0, 0) 1 / (l2distance + 1) from query = 0.444 + * Doc1 = (1, 1) 1 / (l2distance + 1) from query = 0.8 + * Doc2 = (2, 2) 1 / (l2distance + 1) from query = 0.235 + * Doc3 = (3, 3) 1 / (l2distance + 1) from query = 0.089 + * Doc4 = (4, 4) 1 / (l2distance + 1) from query = 0.045 + * + * The expected TOP 3 = [Doc1, Doc0, Doc2] + * @throws IOException + */ Review Comment: this is now discussed in a separate comment -- 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. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org 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