Skip to content
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

Added support for highlighting multi term queries using the postings highlighter #4052

Closed
wants to merge 1 commit into from

Conversation

javanna
Copy link
Member

@javanna javanna commented Nov 2, 2013

Added rewrite of the query using the current top level reader instead of an empty one, rewritten all multi term queries using TopTermsScoringBooleanQueryRewrite(1024) rewrite mode.

As a result, postings highlighter supports now wildcard query, prefix query, fuzzy query, term range query and regexp query.

Closes #4042

@ghost ghost assigned javanna Nov 2, 2013
private static final IndexReader EMPTY_INDEXREADER = new MultiReader();
private static Query rewrite(Query original, IndexReader reader) throws IOException {
if (original instanceof MultiTermQuery) {
MultiTermQuery copy = (MultiTermQuery) original.clone();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to clone the query you can just get the current rewrite method and set it back once you are done? If the rewrite method already allows term extraction we don't need to do anything and if so you can also set the query back into the context via updateRewriteQuery?

@martijnvg
Copy link
Member

+1 lgtm!

@s1monw
Copy link
Contributor

s1monw commented Nov 4, 2013

+1 looks great!

@javanna
Copy link
Member Author

javanna commented Nov 4, 2013

Merged

@javanna javanna closed this Nov 4, 2013
javanna added a commit to javanna/elasticsearch that referenced this pull request Feb 21, 2014
…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
javanna added a commit that referenced this pull request Feb 21, 2014
…level queries

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 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
javanna added a commit that referenced this pull request Feb 21, 2014
…level queries

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 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
javanna added a commit that referenced this pull request Feb 21, 2014
…level queries

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 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
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…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#5127
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…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#5127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Postings highlighter does not support wildcards
3 participants