cleverage / play2-elasticsearch

Elasticsearch module for PlayFramework 2.x applications
MIT License
153 stars 63 forks source link

Highlighter support #31

Open bompi88 opened 11 years ago

bompi88 commented 11 years ago

Looks like it's not supported? If anyone know how, please let me know.

jtammen commented 10 years ago

I just came across this question, too.

As a workaround, instead of using ProfileIndex.finder.search(query), you can do something like this after building your query as usual:

SearchRequestBuilder request = query.getSearchRequestBuilder(IndexUtils
        .getInstanceIndex(MyIndexable.class).getIndexPath(), null);
request.addHighlightedField("field1").addHighlightedField("field2");
IndexResults<MyIndexable> indexResults = query.executeSearchRequest(request);