Reputation: 1491
I have successfully set up highlighting in Solr4, I am indexing docx, xlsx & pdf's mainly so just have fields like url, title & content.
I have Solr highlighting the content field and it displays the small snippet of text, but sometimes the matched word is in the title as opposed to the content and therefore it will not return me a snippet of text
Is there any way of returning even just the first line or two from the content field so that it is not left blank.
Upvotes: 1
Views: 2027
Reputation: 15244
I guess your query URL looks like q=(title:ABC OR content:ABC)&hl=true&hl.fl=title,content
Try adding hl.alternateField
=content
to the query
Upvotes: 2
Reputation: 999
Use fl=content
parameter with your query. If no highlighted content returned then generate snippet from content (fl=content) field returned with each document in result set.
Upvotes: 0