vsop-479 commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2062805026


##########
lucene/core/src/java/org/apache/lucene/util/fst/FSTCompiler.java:
##########
@@ -819,17 +819,11 @@ private void freezeTail(int prefixLenPlus1) throws 
IOException {
       final UnCompiledNode<T> node = frontier[idx];
       final int prevIdx = idx - 1;
       final UnCompiledNode<T> parent = frontier[prevIdx];
-
       final T nextFinalOutput = node.output;
 
-      // We "fake" the node as being final if it has no
-      // outgoing arcs; in theory we could leave it
-      // as non-final (the FST can represent this), but
-      // FSTEnum, Util, etc., have trouble w/ non-final
-      // dead-end states:
-
-      // TODO: is node.numArcs == 0 always false?  we no longer prune any 
nodes from FST:
-      final boolean isFinal = node.isFinal || node.numArcs == 0;
+      // If this node has no outgoing arcs, it should be final.
+      assert node.numArcs != 0 || node.isFinal;
+      final boolean isFinal = node.isFinal;

Review Comment:
   > @vsop-479 could you please add a comment above this line explaining this 
sneakiness?
   
   Thanks @mikemccand , I also added a comment above `final T nextFinalOutput = 
node.output;`



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