Skip to content

Commit

Permalink
Support for highlighting of phrase prefix queries
Browse files Browse the repository at this point in the history
  • Loading branch information
hibnico authored and kimchy committed Jun 27, 2011
1 parent ce6fbc6 commit 759d7d6
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -23,6 +23,7 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.search.*;
import org.apache.lucene.search.spans.SpanTermQuery;
import org.elasticsearch.common.lucene.search.MultiPhrasePrefixQuery;
import org.elasticsearch.common.lucene.search.TermFilter;
import org.elasticsearch.common.lucene.search.XBooleanFilter;
import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery;
Expand Down Expand Up @@ -103,6 +104,12 @@ public CustomFieldQuery(Query query, boolean phraseHighlight, boolean fieldMatch
} else if (sourceQuery instanceof FilteredQuery) {
flatten(((FilteredQuery) sourceQuery).getQuery(), flatQueries);
flatten(((FilteredQuery) sourceQuery).getFilter(), flatQueries);
} else if (sourceQuery instanceof MultiPhrasePrefixQuery) {
try {
flatten(sourceQuery.rewrite(reader.get()), flatQueries);
} catch (IOException e) {
// ignore
}
} else {
super.flatten(sourceQuery, flatQueries);
}
Expand Down

0 comments on commit 759d7d6

Please sign in to comment.