Apache Lucene open-source search software
fix missing flag in FST
Han Jiang87e322b5fca9
diff --git a/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTTermsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTTermsReader.javaindex 8d5aa700b39..9ab5789894c 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTTermsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTTermsReader.java@@ -548,6 +548,10 @@ public class TempFSTTermsReader extends FieldsProducer {}// nocommit: might be great if we can set flag BIT_LAST_ARC+ // nocommit: actually we can use first arc as candidate...+ // it always has NO_OUTPUT as output, and BIT_LAST_ARC set.+ // but we'll have problem if later FST supports output sharing+ // on first arc!/** Virtual frame, never pop */Frame loadVirtualFrame(Frame frame) throws IOException {@@ -701,8 +705,6 @@ public class TempFSTTermsReader extends FieldsProducer {while (!queue.isEmpty()) {final FST.Arc<T> arc = queue.remove(0);final long node = arc.target;- // nocommit: hmm... for startArc, Arc.toString() is broken???- // BIT_ARC_HAS_FINAL_OUTPUT never set//System.out.println(arc);if (FST.targetHasArcs(arc) && !seen.get((int) node)) {seen.set((int) node);diff --git a/lucene/core/src/java/org/apache/lucene/util/fst/FST.java b/lucene/core/src/java/org/apache/lucene/util/fst/FST.javaindex 75ca8a9a29c..b2cbd666052 100644--- a/lucene/core/src/java/org/apache/lucene/util/fst/FST.java+++ b/lucene/core/src/java/org/apache/lucene/util/fst/FST.java@@ -796,6 +796,9 @@ public final class FST<T> {if (emptyOutput != null) {arc.flags = BIT_FINAL_ARC | BIT_LAST_ARC;arc.nextFinalOutput = emptyOutput;+ if (emptyOutput != NO_OUTPUT) {+ arc.flags |= BIT_ARC_HAS_FINAL_OUTPUT;+ }} else {arc.flags = BIT_LAST_ARC;arc.nextFinalOutput = NO_OUTPUT;