jimczi commented on code in PR #12529:
URL: https://github.com/apache/lucene/pull/12529#discussion_r1310862094


##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphBuilder.java:
##########
@@ -205,24 +168,14 @@ private void initializeFromGraph(
           initializedNodes.add(newOrd);
         }
 
-        switch (this.vectorEncoding) {
-          case FLOAT32 -> vectorValue = (float[]) vectors.vectorValue(newOrd);
-          case BYTE -> binaryValue = (byte[]) vectors.vectorValue(newOrd);
-        }
-
         NeighborArray newNeighbors = this.hnsw.getNeighbors(level, newOrd);
         initializerGraph.seek(level, oldOrd);
+        RandomVectorScorer scorer = scorerProvider.scorer(newOrd);
         for (int oldNeighbor = initializerGraph.nextNeighbor();
             oldNeighbor != NO_MORE_DOCS;
             oldNeighbor = initializerGraph.nextNeighbor()) {
           int newNeighbor = oldToNewOrdinalMap.get(oldNeighbor);
-          float score =
-              switch (this.vectorEncoding) {
-                case FLOAT32 -> this.similarityFunction.compare(
-                    vectorValue, (float[]) 
vectorsCopy.vectorValue(newNeighbor));
-                case BYTE -> this.similarityFunction.compare(
-                    binaryValue, (byte[]) 
vectorsCopy.vectorValue(newNeighbor));
-              };
+          float score = scorer.symmetricScore(newOrd, newNeighbor);

Review Comment:
   Yep thanks, I pushed a fix (removing `symmetricScore` entirely).



-- 
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

Reply via email to