1. Please be specific as to what is not working. Is a highlighting section
returned in the results? Is the field missing? Or what?
2. hl.fragsize is in characters. Something like 300 is more realistic.
3. Your "f.DESCRIPTION.hl.snippets=5" is missing its XML tags. I don't think
you need this anyway.
4. hl.alternateField takes a field name, not a field type.
5. Use /browse in the example schema after indexing books.json and set
&wt=xml to see the raw results which has the highlighting. That is what you
will be looking for in your results.
To index books.json, cd to the exampledocs directory and do this:
curl http://localhost:8983/solr/update/json?commit=true --data-binary
@books.json -H 'Content-type:application/json'
For example, here is a test query:
http://localhost:8983/solr/browse/?debugQuery=true&wt=xml&q=the
After the results, you should see a section that starts like this:
<lst name="highlighting">
<lst name="978-0641723445">
<arr name="name">
<str><em>The</em> Lightning Thief</str>
</arr>
</lst>
<lst name="978-1423103349">
<arr name="name">
<str><em>The</em> Sea of Monsters</str>
</arr>
</lst>
The "em" is the highlighting of the search terms.
If you don't see that section, you are probably missing the highlight search
component - see solrconfig in example.
Get comfortable using the example and then replicate the features in your
own handler.
-- Jack Krupansky
-----Original Message-----
From: srini
Sent: Wednesday, May 30, 2012 6:03 PM
To: solr-user@lucene.apache.org
Subject: Highlight the search word in results
I am using solr/browse and I am able to get results for search word. But I
want to highlight the search word in results. I tried below settings in
solr-config.xml and it did not work out. Any ideas?
Any thing I am missing here!!!
solr-config.xml
<requestHandler name="/browse" class="solr.SearchHandler">
<lst name="defaults">
<str name="hl">on</str>
<str name="hl.fl">DESCRIPTION</str>
f.DESCRIPTION.hl.snippets=5
<str name="f.DESCRIPTION.hl.fragsize">10</str>
<str name="f.name.hl.alternateField">text_ws2</str>
</lst>
schema.xml
<fieldType name="text_ws2" class="solr.TextField"
positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<charFilter class="solr.HTMLStripCharFilterFactory"/>
</analyzer>
</fieldType>
<field name="DESCRIPTION" type="text_ws2" indexed="true" stored="true"/>
--
View this message in context:
http://lucene.472066.n3.nabble.com/Highlight-the-search-word-in-results-tp3986935.html
Sent from the Solr - User mailing list archive at Nabble.com.