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
Support highlighting against queries other than the search query #3630
Comments
hmm I am not sure if we should use rescore for this but maybe have a dedicated highlight query? |
I see how having a highlight query might be nice but using the rescore query feels right to me - when you sort highlights by score I expected it to be the same query that orders your results. It wouldn't be difficult to modify the pull request to create an actual highlight query element in the api that defaults to the rescore query if there is one and the main query otherwise. That'd make me happy. |
Alternately I could make the highlight query default to the query and have an option to use the rescore query. That'd work for me too. |
I think using the rescore query by default for highlighting is risky since not every match is required to match it (on the contrary to the main query). But I definitely see the point of using the rescore query to highlight matches to have better snippets. So I agree it would be nice to allow to use the rescore query to highlight matches, or maybe even an arbitrary query, probably with a fallback mechanism so that the main query gets used in case the highlighter couldn't find a snippet to highlight with the rescore query. |
I agree with @jpountz I think that makes most sense to have a dedicated query. |
Dedicated query it is then. Since we're letting the user specify the query themselves I'm included to let the user deal with fallback highlighting with a bool query and boosts or something. |
If anyone has time to comment on this I'd be glad to make any changes you need. I'm happy to rebase it as well I just don't want to rebase it now only to have to rebase it again in a week when folks have time to look at it. |
Removed change that wasn't relevant now that we don't explicitly consider rescore queries and rebased. |
This is useful if you want to highlight terms not in the search query or you want sort highlighted snippets based on another query. Closes #3630
thanks nik! |
one quick small suggestion, might make sense to change the |
We had that exact conversation in the pull request. I like calling it |
It is now possible to highlight an external query using the postings highlighter, relates to elastic#3630 Closes elastic#4121
This is useful if you want to highlight terms not in the search query or you want sort highlighted snippets based on another query. Closes elastic#3630
It is now possible to highlight an external query using the postings highlighter, relates to elastic#3630 Closes elastic#4121
This issue was originally about rescore queryies and I've left it intact below so the discussion makes sense. I've changed the issue to be more general. Now this is a feature request to let the user specify a query against which highlighting will run in the highlight element. Like this:
This is the old issue:
When sorting highlights by score the rescore query should be used if there is one. At least, I think it should be.
This gist: https://gist.github.com/nik9000/6451307
Should spit out:
"Mesopotamia, while Mithna ibn Haris withdraw from <em>central Iraq</em> to the region near the Arabian desert to delay"
Rather than:
"of <em>Iraq</em> fell to the Muslims after initial resistance in the Battle of Hira. File:Ctesiphon, <em>Iraq</em> (2117465493)"
I have a pretty simplistic solution for this I'll submit once I'm done running it through tests.
The text was updated successfully, but these errors were encountered: