kaivalnp commented on code in PR #17013:
URL: https://github.com/apache/lucene/pull/17013#discussion_r4569103011


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorScorer.java:
##########
@@ -278,34 +305,63 @@ private static float quantizedScore(
         };
     OptimizedScalarQuantizer.QuantizationResult indexCorrections =
         targetVectors.getCorrectiveTerms(targetOrd);
+    return quantizedScore(
+        qcDist,
+        queryCorrections,
+        indexCorrections.lowerInterval(),
+        indexCorrections.upperInterval(),
+        indexCorrections.additionalCorrection(),
+        indexCorrections.quantizedComponentSum(),
+        scalarEncoding,
+        targetVectors.dimension(),
+        targetVectors.getCentroidDP(),
+        similarityFunction);
+  }
+
+  /**
+   * Turns {@code qcDist}, the dot product of a quantized query and a 
quantized vector, into a
+   * similarity score using the corrective terms of both. The corrective terms 
of the vector and the
+   * properties of its field are passed as values, so that a caller that reads 
them from the index
+   * allocates nothing and needs no {@link QuantizedByteVectorValues}.
+   *
+   * @param scalarEncoding the encoding of the vectors
+   * @param dimension the dimension of the vectors
+   * @param centroidDp the dot product of the centroid with itself, see {@link
+   *     QuantizedByteVectorValues#getCentroidDP}
+   * @lucene.internal
+   */
+  protected static float quantizedScore(

Review Comment:
   It is a misnomer on my part -- this function converts raw dot products of 
the quantized query x quantized doc into the quantized score (by scaling and 
applying corrections).
   
   It is also called from the new bulk scorer, which is why I separated it from 
the original `quantizeScore` function.
   
   I'll rename to something like `convertToQuantizedScore`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to