fix missing flag in FST

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3069@1506404 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Han Jiang 2013-07-24 06:17:37 +00:00
parent 2ee99c7f4c
commit 87e322b5fc
2 changed files with 7 additions and 2 deletions

View File

@ -548,6 +548,10 @@ public class TempFSTTermsReader extends FieldsProducer {
} }
// nocommit: might be great if we can set flag BIT_LAST_ARC // 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 */ /** Virtual frame, never pop */
Frame loadVirtualFrame(Frame frame) throws IOException { Frame loadVirtualFrame(Frame frame) throws IOException {
@ -701,8 +705,6 @@ public class TempFSTTermsReader extends FieldsProducer {
while (!queue.isEmpty()) { while (!queue.isEmpty()) {
final FST.Arc<T> arc = queue.remove(0); final FST.Arc<T> arc = queue.remove(0);
final long node = arc.target; final long node = arc.target;
// nocommit: hmm... for startArc, Arc.toString() is broken???
// BIT_ARC_HAS_FINAL_OUTPUT never set
//System.out.println(arc); //System.out.println(arc);
if (FST.targetHasArcs(arc) && !seen.get((int) node)) { if (FST.targetHasArcs(arc) && !seen.get((int) node)) {
seen.set((int) node); seen.set((int) node);

View File

@ -796,6 +796,9 @@ public final class FST<T> {
if (emptyOutput != null) { if (emptyOutput != null) {
arc.flags = BIT_FINAL_ARC | BIT_LAST_ARC; arc.flags = BIT_FINAL_ARC | BIT_LAST_ARC;
arc.nextFinalOutput = emptyOutput; arc.nextFinalOutput = emptyOutput;
if (emptyOutput != NO_OUTPUT) {
arc.flags |= BIT_ARC_HAS_FINAL_OUTPUT;
}
} else { } else {
arc.flags = BIT_LAST_ARC; arc.flags = BIT_LAST_ARC;
arc.nextFinalOutput = NO_OUTPUT; arc.nextFinalOutput = NO_OUTPUT;