iverase commented on code in PR #15732:
URL: https://github.com/apache/lucene/pull/15732#discussion_r2931716382


##########
lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene102/Lucene102BinaryQuantizedVectorsReader.java:
##########
@@ -448,4 +565,115 @@ BinarizedByteVectorValues getQuantizedVectorValues() 
throws IOException {
       return quantizedVectorValues;
     }
   }
+
+  // When accessing vectorValue method, targerOrd here means a row ordinal.
+  static class OffHeapBinarizedQueryVectorValues {
+    private final IndexInput slice;
+    private final int dimension;
+    private final int size;
+    protected final byte[] binaryValue;
+    protected final ByteBuffer byteBuffer;
+    private final int byteSize;
+    protected final float[] correctiveValues;
+    private int lastOrd = -1;
+    private int quantizedComponentSum;
+
+    OffHeapBinarizedQueryVectorValues(IndexInput data, int dimension, int 
size) {
+      this.slice = data;
+      this.dimension = dimension;
+      this.size = size;
+      // 4x the quantized binary dimensions
+      int binaryDimensions = (discretize(dimension, 64) / 8) * QUERY_BITS;

Review Comment:
   This is migrated from here: 
https://github.com/apache/lucene/blob/e835af7b2075dc4c5d54fd0c0b063c72474a08c3/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene102/Lucene102BinaryQuantizedVectorsWriter.java#L360
   
   `discretize(dimension, 64)`  computes how many longs we need to hold the 
numbe rof dimensions quantized to 1 bit (There are 64 bit on a long).
   We divide by 8 to compute the number of bytes and we multiply by the 
QUERY_BITS (4x) as defined in the comment.
   



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