-
Notifications
You must be signed in to change notification settings - Fork 1.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
Fix Graph Filter Error in Search #5665
Conversation
Signed-off-by: Mingshi Liu <mingshl@amazon.com>
Signed-off-by: Mingshi Liu <mingshl@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Mingshi Liu <mingshl@amazon.com>
* check if the GraphTokenStreamFiniteStrings graph is empty | ||
* return empty BooleanQuery result | ||
*/ | ||
Iterator<TokenStream> graphIt = graph.getFiniteStrings(); |
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.
Looks much better, thanks @mingshl !
Gradle Check (Jenkins) Run Completed with:
|
test failure in build 8978:
Doesn't seem related to the code change. |
Gradle Check (Jenkins) Run Completed with:
|
In build 8982:
|
Gradle Check (Jenkins) Run Completed with:
|
in build 8984:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
Gradle Check (Jenkins) Run Completed with:
|
* fix graph filter out of bound error Signed-off-by: Mingshi Liu <mingshl@amazon.com> * add changelog Signed-off-by: Mingshi Liu <mingshl@amazon.com> * run gradle spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * reproduce error in unit test Signed-off-by: Mingshi Liu <mingshl@amazon.com> * format to pass spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * organize package Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> (cherry picked from commit 6a7a9a1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* fix graph filter out of bound error Signed-off-by: Mingshi Liu <mingshl@amazon.com> * add changelog Signed-off-by: Mingshi Liu <mingshl@amazon.com> * run gradle spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * reproduce error in unit test Signed-off-by: Mingshi Liu <mingshl@amazon.com> * format to pass spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * organize package Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> (cherry picked from commit 6a7a9a1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* fix graph filter out of bound error Signed-off-by: Mingshi Liu <mingshl@amazon.com> * add changelog Signed-off-by: Mingshi Liu <mingshl@amazon.com> * run gradle spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * reproduce error in unit test Signed-off-by: Mingshi Liu <mingshl@amazon.com> * format to pass spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * organize package Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> (cherry picked from commit 6a7a9a1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* fix graph filter out of bound error Signed-off-by: Mingshi Liu <mingshl@amazon.com> * add changelog Signed-off-by: Mingshi Liu <mingshl@amazon.com> * run gradle spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * reproduce error in unit test Signed-off-by: Mingshi Liu <mingshl@amazon.com> * format to pass spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * organize package Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> (cherry picked from commit 6a7a9a1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-1.x 1.x
# Navigate to the new working tree
pushd ../.worktrees/backport-1.x
# Create a new branch
git switch --create backport/backport-5665-to-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 6a7a9a1b2472f8d4a496d5b976ae16be87893b0e
# Push it to GitHub
git push --set-upstream origin backport/backport-5665-to-1.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-1.x Then, create a pull request where the |
* fix graph filter out of bound error Signed-off-by: Mingshi Liu <mingshl@amazon.com> * add changelog Signed-off-by: Mingshi Liu <mingshl@amazon.com> * run gradle spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * reproduce error in unit test Signed-off-by: Mingshi Liu <mingshl@amazon.com> * format to pass spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * organize package Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> (cherry picked from commit 6a7a9a1)
* Fix Graph Filter Error in Search (#5665) * fix graph filter out of bound error Signed-off-by: Mingshi Liu <mingshl@amazon.com> * add changelog Signed-off-by: Mingshi Liu <mingshl@amazon.com> * run gradle spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * reproduce error in unit test Signed-off-by: Mingshi Liu <mingshl@amazon.com> * format to pass spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * organize package Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> (cherry picked from commit 6a7a9a1) * organize package pass compile test Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com>
* fix graph filter out of bound error Signed-off-by: Mingshi Liu <mingshl@amazon.com> * add changelog Signed-off-by: Mingshi Liu <mingshl@amazon.com> * run gradle spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * reproduce error in unit test Signed-off-by: Mingshi Liu <mingshl@amazon.com> * format to pass spotlessApply Signed-off-by: Mingshi Liu <mingshl@amazon.com> * organize package Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> (cherry picked from commit 6a7a9a1) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Mingshi Liu <mingshl@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description:
curl -XPUT localhost:9200/test-index --data '{ "settings": { "index": { "analysis": { "analyzer": { "search_analyzer": { "filter": [ "stop", "asciifolding", "elision", "lowercase", "synonym_graph", "snowball", "unique" ], "tokenizer": "standard", "type": "custom" }, "index_analyzer": { "filter": [ "stop", "asciifolding", "elision", "word_delimiter", "flatten_graph", "lowercase", "snowball", "unique" ], "tokenizer": "standard", "type": "custom" } }, "filter": { "synonym_graph": { "lenient": "true", "synonyms": [ "head board, bed head, bedhead, headboard" ], "type": "synonym_graph" }, "synonyms": { "synonyms": [ "head board, bed head, bedhead, headboard" ], "type": "synonym" }, "word_delimiter": { "preserve_original": "true", "type": "word_delimiter" } } } } }, "mappings": { "dynamic": "strict", "properties": { "merchandising_keywords": { "analyzer": "index_analyzer", "index_options": "docs", "search_analyzer": "search_analyzer", "type": "text" } } } } ' -H "Content-Type:Application/json"
curl 'localhost:9200/test-index/_search?pretty' --data '{"query": {"match": {"merchandising_keywords": "Gas Lift Storage Bed Frame with Arched Bed Head in King"}}}' -H "Content-Type:Application/json"
'get 404 error' assertion error
[2022-12-29T15:07:35,251][INFO ][o.o.p.PluginsService ] [runTask-0] PluginService:onIndexModule index:[test-index/jVsetp_JTSuPkUBIeKFuYg][2022-12-29T15:07:35,290][DEBUG][o.o.c.c.C.CoordinatorPublication] [runTask-0] publication ended successfully: Publication{term=1, version=3} [2022-12-29T15:07:35,423][DEBUG][o.o.c.c.PublicationTransportHandler] [runTask-0] received diff cluster state version [4] with uuid [aSNgAs0GRIK8AkGNiu_TjQ], diff size [620] [2022-12-29T15:07:35,453][DEBUG][o.o.c.c.C.CoordinatorPublication] [runTask-0] publication ended successfully: Publication{term=1, version=4} [2022-12-29T15:07:49,047][INFO ][o.o.i.s.MatchQuery ] [runTask-0] check the sourceCachingTokenFilter@52e91aa3 term=,bytes=[],startOffset=55,endOffset=55,positionIncrement=0,positionLength=1,type=word,termFrequency=1,keyword=false [2022-12-29T15:07:49,048][INFO ][o.o.i.s.MatchQuery ] [runTask-0] check the GraphTokenStreamFiniteStringsorg.apache.lucene.util.graph.GraphTokenStreamFiniteStrings@6389dd20 [2022-12-29T15:07:49,048][INFO ][o.o.i.s.MatchQuery ] [runTask-0] articulationPoints.length: 0 [2022-12-29T15:07:49,048][INFO ][o.o.i.s.MatchQuery ] [runTask-0] i: 0 [2022-12-29T15:07:49,049][INFO ][o.o.i.s.MatchQuery ] [runTask-0] lastState: -1 [2022-12-29T15:07:49,049][INFO ][o.o.i.s.MatchQuery ] [runTask-0] end: -1 [2022-12-29T15:07:49,049][INFO ][o.o.i.s.MatchQuery ] [runTask-0] catch assertion error: java.lang.AssertionError: state=0 nextState=0
to catch the error raising from lucene, and return empty query. Because there is no path found, no need to go further to analyze the graph, return empty query results.
** this is the query result as expected after the fix:
curl 'localhost:9200/test-index/_search?pretty' --data '{"query": {"match": {"merchandising_keywords": "Gas Lift Storage Bed Frame with Arched Bed Head in King"}}}' -H "Content-Type:Application/json"
{
"took" : 68,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 0,
"relation" : "eq"
},
"max_score" : null,
"hits" : [ ]
}
}
Issues Resolved
#5379
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.