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
Fixed multi term queries support in postings highlighter for non top-level queries #5143
Conversation
The change looks good to me. On a related node: should we have an option to not rewrite queries in order to ensure highlighting remains fast? cc @s1monw |
Makes sense to me, I also plan to look at the upcoming changes in Lucene 4.7 aka faster ways to highlight multi term queries. |
Does it also fixes wildcard highlighting issue? |
@roytmana yes, this change will make wildcard queries highlighted |
If this change would make multi term queries highlight at the speed they do with the plain highlighter then please. I'd prefer the default be the faster option with an option to do the highlighting for multi term queries. If not that then at least a prominent warning. Or something. Sent from my iPhone
|
Hi @nik9000 I see your point... on the other hand if one wants to highlight multi term queries that's what it takes at this time. It feels pretty bad not to return any snippet by default to keep highlighting fast. My take is that the best way to keep highlighting fast is not to highlight multi term queries, that's it. I'd add a warning to the docs that explains what we do with multi term queries and the fact that it can slow things down. Also we might be able to improve this once lucene 4.7 gets released, as mentioned above. |
Sounds good to me. Sent from my iPhone
|
Hi @javanna, will it be merged into 1.0 branch so I can test it? |
} | ||
} | ||
|
||
if (query instanceof XFilteredQuery) { |
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.
this needs to be FilteredQuery
rather than XFilteredQuery
same goes for the XConstantScore
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.
good point I think we should have both then... XFilteredQuery
and XConstantScore
needs to be there otherwise this doesn't work for our filtered query and our constant score 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.
true for XFilteredQuery
used to subclass FilteredQuery
but not for Constant:
public class XConstantScoreQuery extends ConstantScoreQuery {
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.
Agreed
ok LGTM in general while I really don't like how this works in general :( |
Neither do I. One other option is to remove the |
…level queries In elastic#4052 we added support for highlighting multi term queries using the postings highlighter. That worked only for top-level queries though, and not for multi term queries that are nested for instance within a bool query, or filtered query, or a constant score query. The way we make this work is by walking the query structure and temporarily overriding the query rewrite method with a method that allows for multi terms extraction. Closes elastic#5102
In #4052 we added support for highlighting multi term queries using the postings highlighter. That worked only for top-level queries though, and not for multi term queries that are nested for instance within a bool query, or filtered query, or a constant score query.
The way we can make this work is by walking the query structure and temporarily overriding the query rewrite method with a method that allows for multi terms extraction.
Closes #5127