Hi,
it depends a little on your use case. For example if you are indexing text and you want to highlight where in the text the match occurred you could use the Lucene Highlighter API - also discussed
hereHowever, you seem to be interested in which entity property (or Document field) a match occurred. There is no generic API for that. A straight forward approach would be to iterate the results yourself and find where the matched occur. Alternatively, you could use the Lucene explain feature (see discussion
here). Unfortunately, the explain functionality is not very per formant and more of a debugging tool.
It would be interesting to get some more feedback from the community about these type of use cases and how they got solved.
--Hardy