You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Teague James <te...@insystechinc.com> on 2014/05/27 21:41:43 UTC

How to Get Highlighting Working in Velocity (Solr 4.8.0)

My Solr 4.8.0 index includes a field called 'dom_title'. The field is
displayed in the result set. I want to be able to highlight keywords from
this field in the displayed results. I have tried configuring solrconfig.xml
and I have tried adding parameters to the query "&hl=true&hl.fl=dom_title"
but the searched keyword never gets highlighted in the results. I am
attempting to use the Velocity Browse interface to demonstrate this. Most of
the configuration is right out of the box, except for the fields in the
schema.

>From my solrconfig.xml:
<requestHandler name=/browse class="solr.SearchHandler">
	<lst name=defautls">
		<str name="echoParams">explicit</str>
		<str name="wt">velocity</str>
		<str name="v.template">browse</str>
		<str name="v.layout">layout</str>
		<str name="hl">on</str>
		<str name="hl.fl">dom_title</str>
		<str name="hl.encoder">html</str>
		<str name="hl.simple.pre">&lt;b&gt;</str>
		<str name="hl.simple.post">&lt;/b&gt;</str>

I omitted a lot of basic query settings and facet field info from this
snippet to focus on the highlighting component. What am I missing?

-Teague