msokolov commented on code in PR #13872:
URL: https://github.com/apache/lucene/pull/13872#discussion_r1811216599


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/OffHeapQuantizedByteVectorValues.java:
##########
@@ -127,31 +121,42 @@ public int size() {
   }
 
   @Override
-  public byte[] vectorValue(int targetOrd) throws IOException {
-    if (lastOrd == targetOrd) {
-      return binaryValue;
-    }
-    slice.seek((long) targetOrd * byteSize);
-    slice.readBytes(byteBuffer.array(), byteBuffer.arrayOffset(), numBytes);
-    slice.readFloats(scoreCorrectionConstant, 0, 1);
-    decompressBytes(binaryValue, numBytes);
-    lastOrd = targetOrd;
-    return binaryValue;
-  }
+  public QuantizedBytes vectors() throws IOException {
+    return new QuantizedBytes() {
+      ByteBuffer byteBuffer = ByteBuffer.allocate(dimension);
+      byte[] binaryValue = byteBuffer.array();
+      IndexInput input = slice.clone();
+      float[] scoreCorrectionConstant = new float[1];

Review Comment:
   personally I don't care about making these final - the compiler already 
ensures that they are or it wouldn't let you use them in a closure like this. 
As for private, I don't think you can make local variables private, but maybe I 
am missing something.



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