Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support for highlighting of phrase prefix queries

  • Loading branch information...
commit 759d7d693d07cb9661a7484a9b837d8aa23b11b5 1 parent ce6fbc6
@nlalevee nlalevee authored kimchy committed
View
7 modules/elasticsearch/src/main/java/org/apache/lucene/search/vectorhighlight/CustomFieldQuery.java
@@ -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;
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.