shubhamvishu commented on code in PR #16092:
URL: https://github.com/apache/lucene/pull/16092#discussion_r3336318520


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene104/Lucene104ScalarQuantizedVectorsReader.java:
##########
@@ -197,6 +213,14 @@ public RandomVectorScorer getRandomVectorScorer(String 
field, float[] target) th
     if (fi == null) {
       return null;
     }
+    // Rotate the query vector to match the rotated stored vectors.
+    float[] scoringTarget = target;
+    if (isRotationEnabled(field) && target != null) {
+      HadamardRotation rotation = rotationFor(field, fi.dimension);
+      float[] rotated = new float[target.length];
+      rotation.rotate(target, rotated);

Review Comment:
    I addressed this piece and other comments(of having single rotation matrix 
per dim). We now rotate the incoming query only once in the query 
rewrite(`KnnFloatVectorQuery#rewrite`) itself (*no more per segment overhead*) 
and same with rotation matrices. 
   
   > you could create a tiny tool in luceneutil to just do a one-time rotation 
of .vec file?
    
   @mikemccand similar to  having rotation in luceneutil,  now in the latest 
revision of this PR the rotation has a new specific knn vector format(takes 
another knn vector format as input) which completely decouples rotation feature.



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