jainankitk commented on code in PR #13923: URL: https://github.com/apache/lucene/pull/13923#discussion_r2039939835
########## 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: Ah! good point. I thought `replaceLast` is directly using it, but `FSTCompiler#compileNode` might change `node.isFinal`. Although, I am still wondering whether compiler will pick `node.isFinal` for `replaceLast` before or after `FSTCompiler#compileNode`, but better to be explicit! -- 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