-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Collate option in PhraseSuggester should allow returning phrases with no matching docs #6929
Conversation
@@ -195,6 +200,7 @@ curl -XPOST 'localhost:9200/_search' -d { | |||
}, | |||
"params": {"field_name" : "title"}, <3> | |||
"preference": "_primary", <4> | |||
"return_all_phrases": true <5> |
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.
should we make this part of the "collate" : {}
object? I think we can just do something like:
"collate" : {
"prune" : true|false,
"query" : {...}
}
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.
Yes! prune is a much better name, changed
I left some naming comments |
Thanks for the review, @s1monw! I updated the PR with the feedback. |
Now the request looks like: curl -XPOST 'localhost:9200/_search' -d {
"suggest" : {
"text" : "Xor the Got-Jewel",
"simple_phrase" : {
"phrase" : {
"field" : "bigram",
"size" : 1,
"direct_generator" : [ {
...
} ],
"collate": {
"query": {
...
},
"prune": true
}
}
}
}
} and the response: "suggest" : {
"simple_phrase" : [ {
"text" : "Xor the Got-Jewel",
"offset" : 0,
"length" : 17,
"options" : [ {
"text" : ...,
"highlighted": ...,
"score" : ...,
"collate_match" : true
}, {
"text" : ...,
"highlighted": ...,
"score" : ..,
"collate_match": false
} ]
} ]
} If the |
LGTM |
…o matching docs A new option `prune` has been added to allow users to control phrase suggestion pruning when `collate` is set. If the new option is set, the phrase suggestion option will contain a boolean `collate_match` indicating whether the respective result had hits in collation. CLoses elastic#6927
The new option
return_all_phrases
in PhraseSuggester collate will allow the user to control whether all the generated suggestions would be returned. Setting the option will have an additional fieldmatch_exists
in the suggestion options, indicating if there were matched documents for the phrase. The default value for this isfalse
.Currently the request would look as follows:
and the response looks as follows (only when
return_all_phrases
is set totrue
)Closes #6927