Highlighting multi-valued fields

(Matthew A. Brown) #1


I'm starting to work with highlighting and one thing I'm noticing is
I'm not able to get the results I'd like when highlighting
multi-valued fields. For instance, say I have the following document:

{ "tags": ["pizza", "fried chicken"] }

Ideally, if searching for "chicken", I'd like to be able to highlight
in such a way that I can extract "fried chicken" as distinct from
"pizza" from the returned fragment(s). The only behavior I can get,
though, is to return "pizza fried chicken" in a single fragment.

I believe this could be accomplished using the LuceneGapFragmenter:

The idea here is that each value in a multi-valued field is buffered
by a large position increment, and then the GapFragmenter looks for
those and cuts off fragments at large gaps. I'm not sure if ES is
already putting position increment gaps in place -- if so, it would
just be a matter of using the GapFragmenter to perform the

So, does ES expose this functionality today in a way that I've missed?
If not, would it be feasible to put it in place? Happy to submit a
ticket if so.


(system) #2