dungba88 commented on code in PR #12738:
URL: https://github.com/apache/lucene/pull/12738#discussion_r1380008658


##########
lucene/core/src/java/org/apache/lucene/util/fst/NodeHash.java:
##########
@@ -328,7 +298,100 @@ private void rehash(long lastNodeAddress) throws 
IOException {
       }
 
       mask = newMask;
-      entries = newEntries;
+      fstNodeAddress = newEntries;
+      copiedNodeAddress = newCopiedOffsets;
+    }
+
+    // hash code for a frozen node.  this must precisely match the hash 
computation of an unfrozen
+    // node!
+    private long hash(long node, long pos) throws IOException {
+      FST.BytesReader in = getBytesReader(node, pos);

Review Comment:
   Actually I realized that nodeAddress can be retrieved from hashSlot, which 
is just getting from the fstNodeAddress with the hash slot. It means we need an 
extra get() (since the nodeAddress is already known by this point). But that 
would also make it more consistent? Like passing an inconsistent value of 
hashSlot and nodeAddress could be a problem. (We can get the nodeAddress based 
on the hashSlot, but not the other way)
   
   Another way is make the BytesReader store the nodeAddress, and read from 
there. We could use assertion to make sure the hashSlot and nodeAddress is 
consistent.



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