LuXugang commented on code in PR #792:
URL: https://github.com/apache/lucene/pull/792#discussion_r865502085


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene91/Lucene91HnswVectorsReader.java:
##########
@@ -388,115 +400,239 @@ private static class FieldEntry {
     int size() {
       return size;
     }
-
-    int ordToDoc(int ord) {
-      return ordToDocOperator.applyAsInt(ord);
-    }
   }
 
-  /** Read the vector values from the index input. This supports both iterated 
and random access. */
-  static class OffHeapVectorValues extends VectorValues
-      implements RandomAccessVectorValues, RandomAccessVectorValuesProducer {
-
-    private final int dimension;
-    private final int size;
-    private final int[] ordToDoc;
-    private final IntUnaryOperator ordToDocOperator;
-    private final IndexInput dataIn;
-    private final BytesRef binaryValue;
-    private final ByteBuffer byteBuffer;
-    private final int byteSize;
-    private final float[] value;
+  static class DenseOffHeapVectorValues extends OffHeapVectorValues {
 
     private int ord = -1;
     private int doc = -1;
 
-    OffHeapVectorValues(int dimension, int size, int[] ordToDoc, IndexInput 
dataIn) {
-      this.dimension = dimension;
-      this.size = size;
-      this.ordToDoc = ordToDoc;
-      ordToDocOperator = ordToDoc == null ? IntUnaryOperator.identity() : 
(ord) -> ordToDoc[ord];
-      this.dataIn = dataIn;
-      byteSize = Float.BYTES * dimension;
-      byteBuffer = ByteBuffer.allocate(byteSize);
-      value = new float[dimension];
-      binaryValue = new BytesRef(byteBuffer.array(), byteBuffer.arrayOffset(), 
byteSize);
+    public DenseOffHeapVectorValues(int dimension, int size, IndexInput slice) 
{

Review Comment:
   addressed in 
https://github.com/apache/lucene/pull/792/commits/694d242b792616e1ab3ddabc8faccb0f79ab0896
 .



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