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


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene91/Lucene91HnswVectorsReader.java:
##########
@@ -320,13 +323,19 @@ private static class FieldEntry {
     final int numLevels;
     final int dimension;
     private final int size;
-    final int[] ordToDoc;
-    private final IntUnaryOperator ordToDocOperator;
     final int[][] nodesByLevel;
     // for each level the start offsets in vectorIndex file from where to read 
neighbours
     final long[] graphOffsetsByLevel;
-
-    FieldEntry(DataInput input, VectorSimilarityFunction similarityFunction) 
throws IOException {
+    final long docsWithFieldOffset;
+    final long docsWithFieldLength;
+    final short jumpTableEntryCount;
+    final byte denseRankPower;
+    long addressesOffset;

Review Comment:
   > Do we need to write ordToDoc mapping for the dense case, where is 1-1 
mapping between ord and doc? May be, we can skip it in this case?
   
   
   Since after this change, only sparse case will write these meta data, Or 
could we make these new variables be final and set them all `null` like
   
    ```
        // sparse
         if (docsWithFieldOffset != -1 && docsWithFieldOffset != -2) {
           addressesOffset = input.readLong();
           blockShift = input.readVInt();
           meta = DirectMonotonicReader.loadMeta(input, size, blockShift);
           addressesLength = input.readLong();
         }else{
            addressesOffset = null;
           blockShift = null;
           meta = null;
           addressesLength = null;
         }
   ```
   
   which seems a little ugly, could gibe some suggestions?
   



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