Michael
Michael

Reputation: 14268

Solr: I have set `hl=true` but no summaries are being output

I need to get snippets from documents where the query terms are matched to be able to output results similar to Google's snippet beneath the website URL. For example:

Snippet - Wikipedia, the free encyclopedia
en.wikipedia.org/wiki/Snippet
A snippet is defined as a small piece of something, it may in more specific contexts refer to: Sampling (music), the use of a short phrase of a recording as an ...

I have set hl=true and even hl.fl='*' in the query URL and but no summaries are being output.

Solr FAQs say:

For a field to be summarizable it must be both stored and indexed.

I'm using Nutch and Solr and have set them up using this tutorial. What additional steps to I need to take to be able to do this?


Adding sample query and output:

http://localhost:8983/solr/select/?q=test&version=2.2&start=0&rows=10&indent=on&hl=true

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">57</int>
<lst name="params">
<str name="indent">on</str>
<str name="start">0</str>
<str name="q">test</str>
<str name="hl">true</str>
<str name="version">2.2</str>
<str name="rows">10</str>
</lst>
</lst>
<result name="response" numFound="94" start="0">
<doc>
<arr name="anchor">
<str>User:Sir Lestaty de Lioncourt</str>
</arr>
<float name="boost">0.0</float>
<str name="digest">6c27160d0b08068f3873bb2c063508b3</str>
<str name="id">
http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt
</str>
<str name="segment">20111029223245</str>
<str name="title">User:Sir Lestaty de Lioncourt - Wikibooks</str>
<date name="tstamp">2011-10-29T21:34:27.055Z</date>
<str name="url">
http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt
</str>
</doc>
...
</result>
<lst name="highlighting">
<lst name="http://aa.wikibooks.org/wiki/User:Sir_Lestaty_de_Lioncourt"/>
<lst name="http://aa.wikipedia.org/wiki/User:PipepBot"/>
<lst name="http://aa.wikipedia.org/wiki/User:Purodha"/>
...
</lst>
</response>

Upvotes: 2

Views: 498

Answers (1)

d whelan
d whelan

Reputation: 804

Looks like you aren't specifying the field to highlight (hl.fl). You should create a text field to use for highlighting (don't use string type) and have it stored/indexed.

Upvotes: 1

Related Questions