4
votes

Is there any way to retrieve the match field/position for each keyword for each matching document from solr?

For example, if the document has title "Retrieving per keyword/field match position in Lucene Solr -- possible?" and the query is "solr keyword", I'd like to get, in addition to the doc-id (I normally only want the doc-id, not the full document), something that can tell me the matches are at:

solr:
  title: 9
keyword:
  title: 3

I'm pretty sure such info is computing during query execution (for phrase queries), but is it possible to return these to the application?

Thanks!

2

2 Answers

2
votes

Debugging Relevance Issues in Search suggest using Solr analysis, which you can get to from the admin URL, using something like http://localhost:8983/solr/admin/analysis.jsp?highlight=on . This highlights matching terms and gives their position.

2
votes

AFAIK there is no way to do that directly, but you can use hit highlighting to implement it.