1

While doing a search for a text in solr , I am trying to get offset for the search term in the result. for eg :

q=id:123456+((description:"abcde"+document:"abcde"+author:"abcde"))&fl=id,codes&sort=service_date+desc

In response I want:

{
  "offset":"";
}

Currently I am manually calculating that after getting the response in the code.

I am reading on term vector (https://lucene.apache.org/solr/guide/7_2/the-term-vector-component.html), but I am not sure about it. If any one can guide me with any method that would be helpful .

  • 1
    Usually highlighting would be the way to do this, as it gives you back the terms wrapped by identifiable markers; as far as I know termvectors will not give you only information about which terms matched your query. – MatsLindh Aug 21 '20 at 07:47
  • Currently , I get the marker em tags and use that to get the offsets , but does solr provide a better way ? – Krishna Sharma Aug 21 '20 at 10:59
  • @KrishnaSharma can you use the marker em tags to get offsets in the context of the full document? – Daniel Rust Sep 25 '20 at 17:57

0 Answers0