Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int[] nodes() {
int size = size();
int[] nodes = new int[size];
for (int i = 0; i < size; i++) {
nodes[i] = (int) heap.get(i + 1);
nodes[i] = (int) order.apply(heap.get(i + 1));
}
return nodes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void testSearchWithSkewedAcceptOrds() throws IOException {
CircularVectorValues vectors = new CircularVectorValues(nDoc);
HnswGraphBuilder builder =
new HnswGraphBuilder(
vectors, VectorSimilarityFunction.DOT_PRODUCT, 16, 100, random().nextInt());
vectors, VectorSimilarityFunction.EUCLIDEAN, 16, 100, random().nextInt());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain why this test was failing? I'm concerned we somehow dropped support for DOT_PRODUCT now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or ... is the idea that you wanted to change the test so that it would verify the correctness of the ordering, because we didn't have any tests using EUCLIDEAN (ie inverted) scores before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msokolov Right, that's correct. Sorry, the modified version of this test would fail without this patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As EUCLIDEAD distance would use reverse ordering of NeighborQueue for results

HnswGraph hnsw = builder.build(vectors);

// Skip over half of the documents that are closest to the query vector
Expand All @@ -215,7 +215,7 @@ public void testSearchWithSkewedAcceptOrds() throws IOException {
10,
10,
vectors.randomAccess(),
VectorSimilarityFunction.DOT_PRODUCT,
VectorSimilarityFunction.EUCLIDEAN,
hnsw,
acceptOrds,
new SplittableRandom(random().nextLong()));
Expand Down