You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "vsop-479 (via GitHub)" <gi...@apache.org> on 2024/10/17 08:50:06 UTC
[PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
vsop-479 opened a new pull request, #13923:
URL: https://github.com/apache/lucene/pull/13923
### Description
`node.numArcs == 0` happens on the last node(I think we fake it) of a input. But we set it `isFinal`, so we still can remove `node.numArcs == 0`.
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "mikemccand (via GitHub)" <gi...@apache.org>.
mikemccand commented on PR #13923:
URL: https://github.com/apache/lucene/pull/13923#issuecomment-2835240888
Merged to `main` (11.0.0) and `branch_10x` (10.3.0), and add milestone label here. Thanks @vsop-479!
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "mikemccand (via GitHub)" <gi...@apache.org>.
mikemccand merged PR #13923:
URL: https://github.com/apache/lucene/pull/13923
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2039417117
##########
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:
Actually, `node.isFinal` will be reset to false in `FSTCompiler#compileNode`.
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13923:
URL: https://github.com/apache/lucene/pull/13923#issuecomment-2791946674
Please take a look when you get a chance @mikemccand .
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2038934742
##########
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:
I think we need this variable, since `node.isFinal` will be changed later when call `parent.replaceLast` (changed/cleared by `FSTCompiler#compileNode`).
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "jainankitk (via GitHub)" <gi...@apache.org>.
jainankitk commented on PR #13923:
URL: https://github.com/apache/lucene/pull/13923#issuecomment-2833704578
> Hello @jainankitk , Can you merge this change?
@vsop-479 - I don't have the permissions to merge, but I can see that Mike is involved now. He should be able to help get this change merged. Thanks for being patient!
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "jainankitk (via GitHub)" <gi...@apache.org>.
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "jainankitk (via GitHub)" <gi...@apache.org>.
jainankitk commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2039940112
##########
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2040500344
##########
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:
Thanks for promptly reply @jainankitk .
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2062803592
##########
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:
> in case the compiler/JVM executes compileNode before node.isFinal lookup (I think it does?).
Yes, we can varify it by running/debuging:
````
:lucene:backward-codecs:test --tests "org.apache.lucene.backward_index.TestIndexUpgradeBackwardsCompatibility.testIndexUpgraderCommandLineArgs" -Dtests.seed=B2288ADAD229D1A6
````
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13923:
URL: https://github.com/apache/lucene/pull/13923#issuecomment-2832818062
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "jainankitk (via GitHub)" <gi...@apache.org>.
jainankitk commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2037877322
##########
lucene/core/src/java/org/apache/lucene/util/fst/FSTCompiler.java:
##########
@@ -828,7 +828,8 @@ private void freezeTail(int prefixLenPlus1) throws IOException {
// 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:
+ // node.numArcs == 0 happens on last node. But it is final, we still can remove node.numArcs
+ // == 0.
final boolean isFinal = node.isFinal || node.numArcs == 0;
Review Comment:
Should we also remove `node.numArcs == 0` if removing TODO?
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "jainankitk (via GitHub)" <gi...@apache.org>.
jainankitk commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2038859997
##########
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:
nit: we can directly use `node.isFinal`? `isFinal` variable looks unnecessary now.
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2038747491
##########
lucene/core/src/java/org/apache/lucene/util/fst/FSTCompiler.java:
##########
@@ -828,7 +828,8 @@ private void freezeTail(int prefixLenPlus1) throws IOException {
// 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:
+ // node.numArcs == 0 happens on last node. But it is final, we still can remove node.numArcs
+ // == 0.
final boolean isFinal = node.isFinal || node.numArcs == 0;
Review Comment:
Thanks for your review @jainankitk .
> Should we also remove node.numArcs == 0 if removing TODO?
You are right, I removed it.
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13923:
URL: https://github.com/apache/lucene/pull/13923#issuecomment-2451063955
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13923:
URL: https://github.com/apache/lucene/pull/13923#issuecomment-2832852839
Hello @jainankitk , Can you merge this change?
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [PR] Remove TODO in FSTCompiler#freezeTail. [lucene]
Posted by "mikemccand (via GitHub)" <gi...@apache.org>.
mikemccand commented on code in PR #13923:
URL: https://github.com/apache/lucene/pull/13923#discussion_r2062650201
##########
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:
Phew, I think we do indeed need the separate local variable, because `compileNode` indeed changes (clears) `node.isFinal`, and, in case the compiler/JVM executes `compileNode` before `node.isFinal` lookup (I think it does?).
@vsop-479 could you please add a comment above this line explaining this sneakiness?
--
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-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org