calculateExpectedTopK computes the exact Euclidean top-k and the test asserts that every result returned by the HNSW search must appear in that set:
assertTrue("Result " + id + " should be in expected top-k results", expectedIds.contains(id));
Since Lucene99AcceleratedHNSWVectorsFormat uses an approximate nearest-neighbor algorithm (CAGRA-built HNSW graph), it is not guaranteed to return the exact top-k. The assertion fails for legitimately correct approximate results.
Reproduced with:
-Dtests.seed=FFE4A5B93F63EAEF -Dtests.locale=fr-BE -Dtests.timezone=SystemV/PST8PDT
Failure:
Result 858 should be in expected top-k results
calculateExpectedTopKcomputes the exact Euclidean top-k and the test asserts that every result returned by the HNSW search must appear in that set:assertTrue("Result " + id + " should be in expected top-k results", expectedIds.contains(id));Since
Lucene99AcceleratedHNSWVectorsFormatuses an approximate nearest-neighbor algorithm (CAGRA-built HNSW graph), it is not guaranteed to return the exact top-k. The assertion fails for legitimately correct approximate results.Reproduced with:
Failure: