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/02/05 07:55:20 UTC
[PR] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
vsop-479 opened a new pull request, #13072:
URL: https://github.com/apache/lucene/pull/13072
For PrefixQuery, we can terminate the automaton on current term if we have matched the whole prefix, and match this term directly.
Furthermore, if there is a subBlock, we could match all its' sub terms.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1515861738
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
> we need to figure out why Regexp/WildcardQuery are compiling down to 127 as their max on .* suffix transitions?
These queries' (including `AutomatonQuery`)`Automaton` like this: 3 -> 3: [0, 127]; 3 -> 4: [194, 194]; 4 -> 3: [128, 191]. assume 3 is an accept state.
It is more complex to detect wether a state can accept all remaining suffixes for these queries, because its accept states are split into many transitions like: [0, 127], [194, 223], [224, 239], [240, 243], [244], etc.
I am still working on this, any suggestion is welcome @mikemccand.
> Perhaps we could also add tests cases for custom Automata passed to AutomatonQuery matching sometimes binary (non-UTF8) terms?
Added.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1595034249
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -67,12 +68,16 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
points = a.getStartPoints();
size = Math.max(1, a.getNumStates());
accept = new FixedBitSet(size);
+ matchAllSuffix = new FixedBitSet(size);
transitions = new int[size * points.length];
Arrays.fill(transitions, -1);
Transition transition = new Transition();
for (int n = 0; n < size; n++) {
if (a.isAccept(n)) {
accept.set(n);
+ if (canMatchAllSuffix(n)) {
Review Comment:
> Maybe rename to isMatchAllSuffix?
Since there is a method named `isMatchAllSuffix`, I renamed it to `detectMatchAllSuffix`.
--
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r3116325437
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Detect whether this state can accept everything(all remaining suffixes). */
+ private boolean detectMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ Transition transition = new Transition();
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery, custom binary Automata.
+ if (numTransitions == 1) {
+ automaton.getTransition(state, 0, transition);
+ if (transition.dest == state && transition.min == 0 && transition.max == alphabetSize - 1) {
+ return true;
+ }
+ }
+
+ // Apply to RegexpQuery, WildcardQuery.
+ // TODO: Is it enough just check last transition is [0, 127]?.
+ for (int i = 0; i < numTransitions; i++) {
+ automaton.getTransition(state, i, transition);
+ if (transition.min == 0 && transition.max == 127) {
+ if (transition.dest == state) {
+ return true;
+ } else if (automaton.isAccept(transition.dest)) {
+ // recurse
+ return detectMatchAllSuffix(transition.dest);
+ }
+ }
+ }
+ return false;
Review Comment:
That is incorrect, after UTF32ToUTF8 conversion, transitions intentionally have gaps for illegal UTF-8 byte sequences (e.g. [128, 193], surrogate range). These bytes will never appear in indexed terms, so gap-based rejection would incorrectly disqualify valid matchAllSuffix states.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1565442746
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
I think I can detecting a match all suffix state for `Regexp/WildcardQuery`, in `UTF32ToUTF8.convert` after `convertOneEdge` like this:
````
// Writes new transitions into pendingTransitions:
convertOneEdge(utf8State, destUTF8, scratch.min, scratch.max);
// Set match all suffix state.
if(scratch.min == 0 && scratch.max == 1114111 && utf8.isAccept(utf8State) && utf8.isAccept(destUTF8)){
utf8.setMatchAllSuffix(utf8State, true);
}
````
Which is simple and reliable, but will violate the rule below:
> Everything else about Automaton today is fundamental (states, transitions, isAccept) and necessary, but this new member is more a best effort optimization?
Also: I can check whether a candidate state can finally ended on an accept by [128, 191], which is added in `UTF32ToUTF8.adll`, in `RunAutomaton`.
--
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r3099052173
##########
lucene/core/src/java/org/apache/lucene/util/automaton/ByteRunnable.java:
##########
@@ -37,6 +37,14 @@ public interface ByteRunnable {
*/
boolean isAccept(int state);
+ /**
+ * Returns true if this state can accept all remaining suffixes from now on.
+ *
+ * @param state the state
+ * @return whether this state can accept all remaining suffixes.
+ */
+ boolean isMatchAllSuffix(int state);
Review Comment:
`ByteRunnable` is a public interface, and adding a new abstract method (`isMatchAllSuffix`) is a binary/source breaking change for any external implementations. To preserve compatibility, make this a `default` method (e.g., returning `false`) so existing implementors continue to work without recompilation, while allowing optimized implementations to override it.
```suggestion
default boolean isMatchAllSuffix(int state) {
return false;
}
```
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Detect whether this state can accept everything(all remaining suffixes). */
+ private boolean detectMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ Transition transition = new Transition();
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery, custom binary Automata.
+ if (numTransitions == 1) {
+ automaton.getTransition(state, 0, transition);
+ if (transition.dest == state && transition.min == 0 && transition.max == alphabetSize - 1) {
+ return true;
+ }
+ }
+
+ // Apply to RegexpQuery, WildcardQuery.
+ // TODO: Is it enough just check last transition is [0, 127]?.
+ for (int i = 0; i < numTransitions; i++) {
+ automaton.getTransition(state, i, transition);
+ if (transition.min == 0 && transition.max == 127) {
+ if (transition.dest == state) {
+ return true;
+ } else if (automaton.isAccept(transition.dest)) {
+ // recurse
+ return detectMatchAllSuffix(transition.dest);
+ }
+ }
+ }
+ return false;
Review Comment:
`detectMatchAllSuffix` currently hard-codes an ASCII range check (`transition.max == 127`) and returns true as soon as it finds a `[0,127]` transition that loops (or reaches another accept state). This is not sufficient to prove the state accepts *all* remaining suffixes for a DFA over `alphabetSize` symbols, and can incorrectly mark states as `matchAllSuffix`, causing `IntersectTermsEnum` to return terms that do not actually match the automaton. Consider computing `matchAllSuffix` as a fixpoint: a state qualifies iff it is accept, its outgoing transitions cover the full alphabet, and every destination is also `matchAllSuffix` (with cycle detection / memoization to avoid infinite recursion on cyclic graphs).
```suggestion
byte[] memo = new byte[size];
return detectMatchAllSuffix(state, memo);
}
/**
* Memoized fixpoint computation for {@code matchAllSuffix}.
*
* <p>A state matches all remaining suffixes iff it is accept, its outgoing transitions cover the
* full alphabet with no gaps, and every destination state also matches all remaining suffixes.
*
* <p>Memo values: 0 = unknown, 1 = true, 2 = false, 3 = visiting.
*/
private boolean detectMatchAllSuffix(int state, byte[] memo) {
if (memo[state] == 1) {
return true;
} else if (memo[state] == 2) {
return false;
} else if (memo[state] == 3) {
// We reached a cycle. Treat it as provisionally true and let the caller finish validating
// full alphabet coverage for all states in the cycle.
return true;
}
if (automaton.isAccept(state) == false) {
memo[state] = 2;
return false;
}
memo[state] = 3;
Transition transition = new Transition();
int numTransitions = automaton.getNumTransitions(state);
int expectedMin = 0;
for (int i = 0; i < numTransitions; i++) {
automaton.getTransition(state, i, transition);
if (transition.min != expectedMin || detectMatchAllSuffix(transition.dest, memo) == false) {
memo[state] = 2;
return false;
}
expectedMin = transition.max + 1;
}
if (expectedMin != alphabetSize) {
memo[state] = 2;
return false;
}
memo[state] = 1;
return true;
```
##########
lucene/core/src/test/org/apache/lucene/search/TestAutomatonQuery.java:
##########
@@ -16,21 +16,19 @@
*/
package org.apache.lucene.search;
+import static org.apache.lucene.tests.util.TestUtil.alwaysPostingsFormat;
+import static org.apache.lucene.tests.util.TestUtil.getDefaultPostingsFormat;
import static org.apache.lucene.util.automaton.Operations.DEFAULT_DETERMINIZE_WORK_LIMIT;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
+import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.MultiTerms;
-import org.apache.lucene.index.SingleTermsEnum;
-import org.apache.lucene.index.Term;
-import org.apache.lucene.index.Terms;
-import org.apache.lucene.index.TermsEnum;
+import org.apache.lucene.index.*;
Review Comment:
`import org.apache.lucene.index.*;` reduces clarity of dependencies in this test and is inconsistent with most other tests in `org.apache.lucene.search` which list explicit Index imports. Please switch back to explicit imports for the specific types used in this file.
```suggestion
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
```
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -105,6 +139,8 @@ public String toString() {
b.append("state ").append(i);
if (accept.get(i)) b.append(" [accept]:\n");
else b.append(" [reject]:\n");
+ if (matchAllSuffix.get(i)) b.append(" [matchAllSuffix]:\n");
+ else b.append(" [can not matchAllSuffix]:\n");
Review Comment:
The new `toString()` output uses the phrase "can not matchAllSuffix". If this string is intended for human readability/debugging, "cannot" is the standard spelling (or consider omitting the negative case entirely to keep output compact).
```suggestion
else b.append(" [cannot matchAllSuffix]:\n");
```
##########
lucene/core/src/test/org/apache/lucene/search/TestPrefixQuery.java:
##########
@@ -16,15 +16,18 @@
*/
package org.apache.lucene.search;
+import static org.apache.lucene.tests.util.TestUtil.alwaysPostingsFormat;
+import static org.apache.lucene.tests.util.TestUtil.getDefaultPostingsFormat;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.lucene.codecs.PostingsFormat;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.Term;
+import org.apache.lucene.index.*;
Review Comment:
`import org.apache.lucene.index.*;` is the only wildcard import in this test package and makes it harder to see which Index classes are actually used. Prefer explicit imports here for consistency/readability (e.g., as done in `TestWildcardQuery` and `TestRegexpQuery`).
```suggestion
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
```
--
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r3116325437
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Detect whether this state can accept everything(all remaining suffixes). */
+ private boolean detectMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ Transition transition = new Transition();
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery, custom binary Automata.
+ if (numTransitions == 1) {
+ automaton.getTransition(state, 0, transition);
+ if (transition.dest == state && transition.min == 0 && transition.max == alphabetSize - 1) {
+ return true;
+ }
+ }
+
+ // Apply to RegexpQuery, WildcardQuery.
+ // TODO: Is it enough just check last transition is [0, 127]?.
+ for (int i = 0; i < numTransitions; i++) {
+ automaton.getTransition(state, i, transition);
+ if (transition.min == 0 && transition.max == 127) {
+ if (transition.dest == state) {
+ return true;
+ } else if (automaton.isAccept(transition.dest)) {
+ // recurse
+ return detectMatchAllSuffix(transition.dest);
+ }
+ }
+ }
+ return false;
Review Comment:
After UTF32ToUTF8 conversion, transitions intentionally have gaps for illegal UTF-8 byte sequences (e.g. [128, 193], surrogate range). These bytes will never appear in indexed terms, so gap-based rejection would incorrectly disqualify valid matchAllSuffix states.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "mikemccand (via GitHub)" <gi...@apache.org>.
mikemccand commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1966886223
I will have a look -- thanks for the ping @jpountz.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2052720580
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-5627581918
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1980188859
> I think the optimization may be similar to the one done in AutomatonTermsEnum?
It seems the optimization of `AutomatonTermsEnum` is to improve iterating term mode, from seeking bytes from DFA and seek termsEnum(`seekCeil`), to simply sequential reads the termsEnum, after finding a loop(`setLinear`).
In both mode, `AutomatonTermsEnum` needs to check if the term is accepted by running automaton.
If I am not mistaken, this optimization is different from `AutomatonTermsEnum`'s. It directly matches all reminding suffixes and sub blocks, after detecting an accept state with a `.*` transition back onto itself.
Or maybe you mean we can improve `AutomatonTermsEnum`'s optimization, to implement this optimization's effect? @rmuir
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1515861738
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
> we need to figure out why Regexp/WildcardQuery are compiling down to 127 as their max on .* suffix transitions?
These queries' (including `AutomatonQuery`)`Automaton` like this: 3 -> 3: [0, 127]; 3 -> 4: [194, 194]; 4 -> 3: [128, 191]. assume 3 is an accept state.
It is more complex to detect whether a state can accept all remaining suffixes for these queries, because its accept states are split into many transitions like: [0, 127], [194, 223], [224, 239], [240, 243], [244], etc.
I am still working on this, any suggestion is welcome @mikemccand.
> Perhaps we could also add tests cases for custom Automata passed to AutomatonQuery matching sometimes binary (non-UTF8) terms?
Added.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1972857051
There is still problem in the implementation of detecting whether accept state can match all suffix (`RunAutomaton.canMatchAllSuffix`), I am trying to figure it out.
On the other hand, I will dig into AutomatonTermsEnum's optimization.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1505583695
##########
lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java:
##########
@@ -70,6 +70,7 @@ public class Automaton implements Accountable, TransitionAccessor {
private int[] states;
private final BitSet isAccept;
+ private final BitSet terminable;
Review Comment:
> If a bit is set for a state, does that mean this state accepts everything from now on (all possible suffixes)?
Yes, you are right about this.
> Could we maybe rename it to isMatchAllSuffix or so?
I will rename it (and remove it to `RunAutomaton`)
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1565442746
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
@mikemccand
I think I can detecting a match all suffix state for `Regexp/WildcardQuery`, in `UTF32ToUTF8.convert` after `convertOneEdge` like this:
````
// Writes new transitions into pendingTransitions:
convertOneEdge(utf8State, destUTF8, scratch.min, scratch.max);
// Set match all suffix state.
if(scratch.min == 0 && scratch.max == 1114111 && utf8.isAccept(utf8State) && utf8.isAccept(destUTF8)){
utf8.setMatchAllSuffix(utf8State, true);
}
````
Which is simple and reliable, but will violate the rule below:
> Everything else about Automaton today is fundamental (states, transitions, isAccept) and necessary, but this new member is more a best effort optimization?
Other plan: Checking whether a candidate state can finally ended on an accept by [128, 191], which is added in `UTF32ToUTF8.all`:
````
utf8.addTransition(lastN, end, 128, 191); // type = all*
````
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2283359055
Conflicts resolved.
--
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-3408725874
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "mikemccand (via GitHub)" <gi...@apache.org>.
mikemccand commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1514268562
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/IntersectTermsEnum.java:
##########
@@ -534,6 +555,9 @@ private BytesRef _next() throws IOException {
// Match! Recurse:
copyTerm();
currentFrame = pushFrame(state);
+ if (matchAllSuffix) {
Review Comment:
Couldn't you just do `currentFrame.matchAllSuffix = matchAllsuffix`?
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
Can we remove this special case? Just let the `for` loop below handle the 1-transition case too?
Edit: hmm, I see, it is subtly different: this is checking for max label `255` but the loop below is checking `127`, hmmm. This is a bit messy -- this low level of code shouldn't be specializing to different automata that come from the high level queries. Can we use `alphabetSize-1` as the `transition.max` check instead? But, separately, we need to figure out why `Regexp/WildcardQuery` are compiling down to `127` as their max on `.*` suffix transitions? That is not even correct for matching UTF-8 encoded terms.
Perhaps we could also add tests cases for custom `Automata` passed to `AutomatonQuery` matching sometimes binary (non-UTF8) terms?
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
+ Transition transition = new Transition();
+ automaton.getTransition(state, 0, transition);
+ if (transition.dest == state && transition.min == 0 && transition.max == 255) {
+ return true;
+ }
+ }
+
+ // Apply to RegexpQuery, WildcardQuery.
+ for (int i = 0; i < numTransitions; i++) {
+ Transition transition = new Transition();
+ automaton.getTransition(state, i, transition);
+ if (transition.dest == state && transition.min == 0 && transition.max == 127) {
Review Comment:
Maybe refactor this to:
```
if (transition.min == 0 && transition.max == 127) {
if (transition.dest == state) {
return true;
} else if (automaton.isAccept(transition.dest) {
// recurse
return isMatchAllSuffix(transition.dest);
}
}
```
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
+ Transition transition = new Transition();
+ automaton.getTransition(state, 0, transition);
+ if (transition.dest == state && transition.min == 0 && transition.max == 255) {
+ return true;
+ }
+ }
+
+ // Apply to RegexpQuery, WildcardQuery.
+ for (int i = 0; i < numTransitions; i++) {
+ Transition transition = new Transition();
Review Comment:
Maybe allocate this scratch `Transition` once up front at the start of the method?
##########
lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/IntersectTermsEnum.java:
##########
@@ -390,10 +391,27 @@ private BytesRef _next() throws IOException {
nextTerm:
while (true) {
+ // Match sub block's entry directly.
+ if (currentFrame.matchAllSuffix) {
+ while (true) {
+ // TODO: Is it necessary to set currentTransition, state etc.
Review Comment:
I don't think this is needed, since you short-circuit all the logic here for the "match all" case, and when this frame is popped it will be reset properly (with `currentTransition`, `state`, etc.) on the next recursion. So maybe change this `TODO` into a comment as to why we don't need to set these members?
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -67,12 +68,16 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
points = a.getStartPoints();
size = Math.max(1, a.getNumStates());
accept = new FixedBitSet(size);
+ matchAllSuffix = new FixedBitSet(size);
transitions = new int[size * points.length];
Arrays.fill(transitions, -1);
Transition transition = new Transition();
for (int n = 0; n < size; n++) {
if (a.isAccept(n)) {
accept.set(n);
+ if (canMatchAllSuffix(n)) {
Review Comment:
Maybe rename to `isMatchAllSuffix`?
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1515861738
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
> we need to figure out why Regexp/WildcardQuery are compiling down to 127 as their max on .* suffix transitions?
These queries' (including `AutomatonQuery`)`Automaton` like this: [0, 127]: 3 -> 3; [194, 194]: 3 -> 4; [128, 191]: 4 -> 3. assume 3 is an accept state.
It is more complex to detect wether a state can accept all remaining suffixes for these queries, because its accept states split many transitions like:[0, 127], [194, 223], [224, 239], [240, 243], [244], etc.
I am still working on this, any suggestion is welcome @mikemccand.
> Perhaps we could also add tests cases for custom Automata passed to AutomatonQuery matching sometimes binary (non-UTF8) terms?
Added.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2083913815
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2128266558
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "rmuir (via GitHub)" <gi...@apache.org>.
rmuir commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1968087576
I think the optimization may be similar to the one done in AutomatonTermsEnum?
https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/index/AutomatonTermsEnum.java#L149-L153
When "ping-ponging" the term dictionary against the automaton, it tracks `visited` bitset and looks for such loops in the automaton. when it finds one, it temporarily acts like a TermRangeQuery.
I think, it works a bit more general than just prefixquery and also helps with regex and wildcard queries too.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1544202746
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
> These queries' (including AutomatonQuery)Automaton like this: 3 -> 3: [0, 127]; 3 -> 4: [194, 194]; 4 -> 3: [128, 191]. assume 3 is an accept state.
@mikemccand
I can track an accept state's other transitions, to check whether these transitions can finally ended on an accept (typically transited by [128, 191]). But i am not sure whether it is enough to judge an state can match all suffix, even not sure whether it is necessary, since maybe it is equivalent to just check the [0, 127] transition's dest is an accept state.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2182075476
@mikemccand
I think this change is close for `PrefixQuery`, `TermRangeQuery`, and custom binary `AutomatonQuery`.
As for `RegexpQuery` and `WildcardQuery`, whose automata converted by `UTF32ToUTF8`. We just get accept transitions [0, 127] in `RunAutomaton`, I am not sure whether it is enough that just check the accept state is transition is [0, 127].
Another approach is set matchAllSuffix in `UTF32ToUTF8`, but need to add a unFundamental member to `Automaton`.
Or, can we just push this change for `Prefix/TermRangeQuery`, and leave a `TODO` for `Regexp/WildcardQuery` temporarily?
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1505621389
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -67,12 +68,16 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
points = a.getStartPoints();
size = Math.max(1, a.getNumStates());
accept = new FixedBitSet(size);
+ terminable = new FixedBitSet(size);
Review Comment:
> we could solely store it in RunAutomaton, if we can efficiently find final states that effectively have .* transitions to themselves?
I will try it.
Actually, I judged wether `Automaton` can match all suffixes from accept states in my first commit like this:
````
if (runAutomaton.isAccept(state) && automaton.getNumTransitions(state) == 1) {
Transition transition = new Transition();
automaton.getTransition(state, 0, transition);
if (transition.dest == state && transition.min == 0 && transition.max == 255) {
break;
}
````
But it only apply to `PrefixQuery`. It seems like that the `Automaton`'s accept state's `Transition` is split into many in `RegexpQuery`. I will try to find other way.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1974836248
@mikemccand
I renamed the field used to indicate wether an accept state can match all suffixes, and detected it in `RunAutomaton`.
Please take a look when you get a chance.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1983159835
> Have you tried to measure any performance change with this? E.g. you could run a luceneutil benchy with just PrefixQuery, or, Regexp/WildcardQuery that also have this property (match-all states in their automata).
I measured it with current implementation with `wikimedium1m`, the result is unstable:
````
TaskQPS baseline StdDevQPS my_modified_version StdDev Pct diff p-value
Prefix3 879.20 (9.1%) 995.37 (4.2%) 13.2% ( 0% - 29%) 0.062
Prefix3 924.98 (9.9%) 1042.17 (7.9%) 12.7% ( -4% - 33%) 0.083
````
````
TaskQPS baseline StdDevQPS my_modified_version StdDev Pct diff p-value
Prefix3 1480.94 (8.8%) 1559.89 (6.4%) 5.3% ( -9% - 22%) 0.195
Prefix3 1242.80 (6.9%) 1307.30 (5.3%) 5.2% ( -6% - 18%) 0.299
Prefix3 177.54 (1.3%) 202.74 (6.3%) 14.2% ( 6% - 22%) 0.000
````
--
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2759878644
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1515793831
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -67,12 +68,16 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
points = a.getStartPoints();
size = Math.max(1, a.getNumStates());
accept = new FixedBitSet(size);
+ matchAllSuffix = new FixedBitSet(size);
transitions = new int[size * points.length];
Arrays.fill(transitions, -1);
Transition transition = new Transition();
for (int n = 0; n < size; n++) {
if (a.isAccept(n)) {
accept.set(n);
+ if (canMatchAllSuffix(n)) {
Review Comment:
> Maybe rename to isMatchAllSuffix?
I don't like that name too. But, there is a method named isMatchAllSuffix, which indicates whether a state can accept all remaining suffixes (similar to `isAccept`).
````
public final boolean isMatchAllSuffix(int state) {
return matchAllSuffix.get(state);
}
````
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1956282319
@jpountz Please take a look when you get a chance.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1505632559
##########
lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java:
##########
@@ -92,6 +93,7 @@ public Automaton() {
public Automaton(int numStates, int numTransitions) {
states = new int[numStates * 2];
isAccept = new BitSet(numStates);
+ terminable = new BitSet(numStates);
Review Comment:
> E.g. if I build a RegexpQuery that is actually a PrefixQuery we won't set this?
Yes, I just implemented this in `PrefixQuery` in current version.
> Everything else about Automaton today is fundamental (states, transitions, isAccept) and necessary, but this new member is more a best effort optimization?
Yes, I will remove 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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1595034249
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -67,12 +68,16 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
points = a.getStartPoints();
size = Math.max(1, a.getNumStates());
accept = new FixedBitSet(size);
+ matchAllSuffix = new FixedBitSet(size);
transitions = new int[size * points.length];
Arrays.fill(transitions, -1);
Transition transition = new Transition();
for (int n = 0; n < size; n++) {
if (a.isAccept(n)) {
accept.set(n);
+ if (canMatchAllSuffix(n)) {
Review Comment:
> Maybe rename to isMatchAllSuffix?
Since there already is a method named `isMatchAllSuffix`, I renamed it to `detectMatchAllSuffix`.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1565442746
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
@mikemccand
I think I can detect a match all suffix state for `Regexp/WildcardQuery`, in `UTF32ToUTF8.convert` after `convertOneEdge` like this:
````
// Writes new transitions into pendingTransitions:
convertOneEdge(utf8State, destUTF8, scratch.min, scratch.max);
// Set match all suffix state.
if(scratch.min == 0 && scratch.max == 1114111 && utf8.isAccept(utf8State) && utf8.isAccept(destUTF8)){
utf8.setMatchAllSuffix(utf8State, true);
}
````
Which is simple and reliable, but will violate the rule below:
> Everything else about Automaton today is fundamental (states, transitions, isAccept) and necessary, but this new member is more a best effort optimization?
Other plan: Checking whether a candidate state can finally ended on an accept by [128, 191], which is added in `UTF32ToUTF8.all`:
````
utf8.addTransition(lastN, end, 128, 191); // type = all*
````
--
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2822769419
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1515793831
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -67,12 +68,16 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
points = a.getStartPoints();
size = Math.max(1, a.getNumStates());
accept = new FixedBitSet(size);
+ matchAllSuffix = new FixedBitSet(size);
transitions = new int[size * points.length];
Arrays.fill(transitions, -1);
Transition transition = new Transition();
for (int n = 0; n < size; n++) {
if (a.isAccept(n)) {
accept.set(n);
+ if (canMatchAllSuffix(n)) {
Review Comment:
> Maybe rename to isMatchAllSuffix?
I don't like that name too. But, there is a method named isMatchAllSuffix, which indicates whether a state can accept all remaining suffixes (similar to `isAccept`).
Maybe we can rename to another?
````
public final boolean isMatchAllSuffix(int state) {
return matchAllSuffix.get(state);
}
````
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1565285501
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
> we need to figure out why Regexp/WildcardQuery are compiling down to 127 as their max on .* suffix transitions?
I think we split the transition([0, 1114111]) with `utf8` edges in `UTF32ToUTF8.convertOneEdge`.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1961611793
`IntersectsTermsEnum` is a bit scary to me, maybe @mikemccand can take a look, I expect him to be more familiar with 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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1505632559
##########
lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java:
##########
@@ -92,6 +93,7 @@ public Automaton() {
public Automaton(int numStates, int numTransitions) {
states = new int[numStates * 2];
isAccept = new BitSet(numStates);
+ terminable = new BitSet(numStates);
Review Comment:
> E.g. if I build a RegexpQuery that is actually a PrefixQuery we won't set this?
Yes, I only implemented this in `PrefixQuery` in current version.
> Everything else about Automaton today is fundamental (states, transitions, isAccept) and necessary, but this new member is more a best effort optimization?
Yes, I will remove 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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2522219093
Hi @mikemccand , Can we push on 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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2212065276
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-4393277155
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2513257967
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2313794696
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] Terminate automaton when it can match all suffixes, and match suffixes directly. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-2558279656
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1544202746
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -96,6 +101,35 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
}
}
+ /** Returns true if this state can accept everything(all remaining suffixes). */
+ private boolean canMatchAllSuffix(int state) {
+ assert automaton.isAccept(state);
+ int numTransitions = automaton.getNumTransitions(state);
+ // Apply to PrefixQuery, TermRangeQuery.
+ if (numTransitions == 1) {
Review Comment:
> These queries' (including AutomatonQuery)Automaton like this: 3 -> 3: [0, 127]; 3 -> 4: [194, 194]; 4 -> 3: [128, 191]. assume 3 is an accept state.
@mikemccand
I can track an accept state's other transitions, to check wether these transitions can finally ended on an accept (typically transited by [128, 191]). But i am not sure wether it is enough to judge an state can match all suffix, even not sure wether it is necessary, since maybe it is equivalent to just check the [0, 127] transition's dest is an accept state.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1968284534
> I think the optimization may be similar to the one done in AutomatonTermsEnum?
Thanks for reminding that, I will dig into `AutomatonTermsEnum`'s optimization.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "vsop-479 (via GitHub)" <gi...@apache.org>.
vsop-479 commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1968078407
@mikemccand Thanks for you suggestion, I am trying to implement it.
> Have you tried to measure any performance change with this? E.g. you could run a luceneutil benchy with just PrefixQuery, or, Regexp/WildcardQuery that also have this property (match-all states in their automata).
I am working on this too.
@jpountz Thanks for you reply.
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "mikemccand (via GitHub)" <gi...@apache.org>.
mikemccand commented on code in PR #13072:
URL: https://github.com/apache/lucene/pull/13072#discussion_r1504523798
##########
lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java:
##########
@@ -92,6 +93,7 @@ public Automaton() {
public Automaton(int numStates, int numTransitions) {
states = new int[numStates * 2];
isAccept = new BitSet(numStates);
+ terminable = new BitSet(numStates);
Review Comment:
One spooky thing about this new `BitSet` is it is "best effort" now? I.e. one could create an Automaton that indeed has some states that match all suffixes, but forget to set the bit here? E.g. if I build a `RegexpQuery` that is actually a `PrefixQuery` we won't set this?
Everything else about `Automaton` today is fundamental (states, transitions, isAccept) and necessary, but this new member is more a best effort optimization?
##########
lucene/core/src/java/org/apache/lucene/util/automaton/Automaton.java:
##########
@@ -70,6 +70,7 @@ public class Automaton implements Accountable, TransitionAccessor {
private int[] states;
private final BitSet isAccept;
+ private final BitSet terminable;
Review Comment:
At first I couldn't understand what `terminable` means.
If a bit is set for a state, does that mean this state accepts everything from now on (all possible suffixes)?
Could we maybe rename it to `isMatchAllSuffix` or so?
##########
lucene/core/src/java/org/apache/lucene/util/automaton/RunAutomaton.java:
##########
@@ -67,12 +68,16 @@ protected RunAutomaton(Automaton a, int alphabetSize) {
points = a.getStartPoints();
size = Math.max(1, a.getNumStates());
accept = new FixedBitSet(size);
+ terminable = new FixedBitSet(size);
Review Comment:
Perhaps, instead of storing this concept in `Automaton`, we could solely store it in `RunAutomaton`, if we can efficiently find final states that effectively have `.*` transitions to themselves?
--
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] Terminate automaton after matched the whole prefix for PrefixQuery. [lucene]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13072:
URL: https://github.com/apache/lucene/pull/13072#issuecomment-1953303608
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