You might want to take a look at https://issues.apache.org/jira/browse/SOLR-4722 ( 'highlighter which generates a list of query term positions'). We used it a while back and doesn't appear to have been used in any Solr > 4.10)
-Simon On Tue, Nov 29, 2016 at 11:43 AM, John Bickerstaff <j...@johnbickerstaff.com > wrote: > All, > > One of the questions I've been asked to answer / prove out is around the > question of highlighting query matches in responses. > > BTW - One assumption I'm making is that highlighting is basically a > function of storing offsets for terms / tokens at index time. If that's > not right, I'd be grateful for pointers in the right direction. > > My underlying need is to get highlighting on search term matches for > returned documents. I need to choose between doing this in Solr and using > an external document store, so I'm interested in whether Solr can provide > the doc store with the information necessary to identify which section(s) > of the doc to highlight in a query response... > > A few questions: > > 1. This page doesn't say a lot about how things work - is there somewhere > with more information on dealing with offsets and highlighting? On offsets > and how they're handled? > https://cwiki.apache.org/confluence/display/solr/Highlighting > > 2. Can I return offset information with a query response or is that > internal only? If yes, can I return offset info if I have NOT stored the > data in Solr but indexed only? > > (Explanation: Currently my project is considering indexing only and storing > the entire text elsewhere -- using Solr to return only doc ID's for > searches. If Solr could also return offsets, these could be used in > processing the text stored elsewhere to provide highlighting) > > 3. Do I assume correctly that in order for Solr highlighting to work > correctly, the text MUST also be stored in Solr (I.E. not indexed only, but > stored=true) > > Many thanks... >