-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset Token position on reuse in predicate_token_filter
#47424
Reset Token position on reuse in predicate_token_filter
#47424
Conversation
Pinging @elastic/es-search (:Search/Analysis) |
@elasticmachine update branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments but the fix looks good to me
...-common/src/test/java/org/elasticsearch/analysis/common/PredicateTokenScriptFilterTests.java
Show resolved
Hide resolved
@@ -69,5 +69,11 @@ protected boolean accept() throws IOException { | |||
token.updatePosition(); | |||
return script.execute(token); | |||
} | |||
|
|||
@Override | |||
public void reset() throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ScriptedConditionTokenFilterFactory
has the same issue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++, will update and add a test
…eset' into bug/predicate-token-filter-reset
Most of the information in AnalysisPredicateScript.Token is pulled directly from its underlying AttributeSource, but we also keep track of the token position, and this state is held directly on the Token. This information needs to be reset when the containing ScriptFilteringTokenFilter or ScriptedConditionTokenFilter is re-used. Fixes #47197
Most of the information in AnalysisPredicateScript.Token is pulled directly from its underlying AttributeSource, but we also keep track of the token position, and this state is held directly on the Token. This information needs to be reset when the containing ScriptFilteringTokenFilter or ScriptedConditionTokenFilter is re-used. Fixes #47197
Most of the information in
AnalysisPredicateScript.Token
is pulled directlyfrom its underlying AttributeSource, but we also keep track of the token position,
and this state is held directly on the Token. This information needs to be reset when
the containing
ScriptFilteringTokenFilter
is re-used.Fixes #47197