mikemccand commented on a change in pull request #657: LUCENE-8781: FST direct 
arc addressing
URL: https://github.com/apache/lucene-solr/pull/657#discussion_r280692040
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/util/fst/FST.java
 ##########
 @@ -865,20 +939,32 @@ public int readNextArcLabel(Arc<T> arc, BytesReader in) 
throws IOException {
       } else {
         in.setPosition(pos);
       }
+      // skip flags
+      in.readByte();
     } else {
       if (arc.bytesPerArc != 0) {
         //System.out.println("    nextArc real array");
-        // arcs are at fixed entries
-        in.setPosition(arc.posArcsStart);
-        in.skipBytes((1+arc.arcIdx)*arc.bytesPerArc);
+        // arcs are in an array
+        if (arc.arcIdx >= 0) {
+          in.setPosition(arc.posArcsStart);
+          // point at next arc, -1 to skip flags
+          in.skipBytes((1 + arc.arcIdx) * arc.bytesPerArc + 1);
+        } else {
+          in.setPosition(arc.nextArc);
+          byte flags = in.readByte();
+          // skip missing arcs
+          while (flag(flags, BIT_MISSING_ARC)) {
 
 Review comment:
   It would be nice (separate issue) if we could track counters of how many 
"arc scans" (typically done by `seekCeil` from Lucene's terms dict) versus 
"direct lookups" are done, in a typical use case ... but that's a future issue.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to