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


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene91/Lucene91HnswVectorsReader.java:
##########
@@ -507,8 +515,90 @@ public BytesRef binaryValue(int targetOrd) throws 
IOException {
     }
 
     private void readValue(int targetOrd) throws IOException {
-      dataIn.seek((long) targetOrd * byteSize);
-      dataIn.readBytes(byteBuffer.array(), byteBuffer.arrayOffset(), byteSize);
+      slice.seek((long) targetOrd * byteSize);
+      slice.readBytes(byteBuffer.array(), byteBuffer.arrayOffset(), byteSize);
+    }
+
+    public IndexedDISI initDISI(IndexInput vectorData) throws IOException {
+      // dense
+      if (fieldEntry == null || fieldEntry.docsWithFieldOffset == -1) {
+        return null;
+      }
+      assert fieldEntry.docsWithFieldOffset != -2;
+      // sparse
+      return new IndexedDISI(
+          vectorData,
+          fieldEntry.docsWithFieldOffset,
+          fieldEntry.docsWithFieldLength,
+          fieldEntry.jumpTableEntryCount,
+          fieldEntry.denseRankPower,
+          fieldEntry.size);
+    }
+
+    public static final OffHeapVectorValues emptyOffHeapVectorValues(int 
dimension)

Review Comment:
   > I think it'd be clearer if we separated out the sparse and dense cases 
into two different subclasses
   
   
   Totally agreed! It makes code much more readable. but I still want to keep 
`emptyOffHeapVectorValues` which has been renamed to `EmptyOffHeapVectorValues` 
in latest PR,  I would like to keep same pattern like 
`Lucene90NormsProducer#getNorms` or `Lucene90DocValuesProducer#getXXX`.
   
   Addressd in 
https://github.com/apache/lucene/pull/792/commits/49f67a57e8e294fbed2a63d4887169103f05073b
 .
   
   
   
   
   



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