If you've configured your schema correctly where the fields to be highlighted must have "stored=true", then most of the work is in your constructed query. You need to add the following to your query:
- hl=true
- hl.fl=*
http://localhost:8989/solr/select?q=britta&hl=true&hl.fl=*
And an example response might be:
<response>
−
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">8</int>
−
<lst name="params">
<str name="q">britta</str>
<str name="hl.fl">*</str>
<str name="hl">true</str>
</lst>
</lst>
−
<result name="response" numFound="1" start="0">
−
<doc>
<str name="description">britta is awesome</str>
<str name="id">poddObject:67</str>
</doc>
</result>
−
<lst name="highlighting">
−
<lst name="poddObject:67">
−
<arr name="description">
<str><em>britta</em> is awesome</str>
</arr>
</lst>
</lst>
</response>
If it's still not working for you, here is another reference that provides additional things you should look for:
http://www.mail-archive.com/solr-user@lucene.apache.org/msg11031.html
Phil
This comment has been removed by a blog administrator.
ReplyDelete