It seems to me that you are looking for Solr's highlighting functionality:
https://cwiki.apache.org/confluence/display/solr/Highlighting HTH, Emir On 27.03.2017 09:09, forest_soup wrote:
We are going to implement a feature: When opening a document whose body field is already indexed in Solr, if we issued a keyword search before opening the doc, highlight the keyword in the opening document. That needs the position/offset info of the keyword in the doc's index, which I think can be indexed or stored in solr in anyway. And we are searching ways to retrieve them from any solr api. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Is-there-a-way-to-retrieve-the-a-term-s-position-offset-in-Solr-tp4326931.html Sent from the Solr - User mailing list archive at Nabble.com.
-- Monitoring * Alerting * Anomaly Detection * Centralized Log Management Solr & Elasticsearch Support * http://sematext.com/