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

 ##########
 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:
   great idea - perhaps if we add some Arc abstractions that would provide a 
nice hook for such tracking/counting

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to