Set hl.usePhraseHighlighter parameter to true:

http://wiki.apache.org/solr/HighlightingParameters#hl.usePhraseHighlighter

Koji

Paul Tomblin wrote:
If I do a query for a couple of words in quotes, Solr correctly only returns
pages where those words appear exactly within the quotes.  But the
highlighting acts as if the words were given separately, and stems them and
everything.  For example, if I search for "knee pain", it returns a document
that has the word "knee pain", and doesn't return documents that have "knee"
and "pain" without other words between them.  However, with highlighting
turned on, the highlighted field will have "knee", "knees", "pain" and
"pains" highlighted even when they aren't next to each other.
For instance:
<response><lst name='responseHeader'><int name='status'>0</int>
<int name='QTime'>45</int>
<lst name='params'><str name='explainOther'/>
<str name='fl'>*,score</str>
<str name='indent'>on</str>
<str name='start'>0</str>
<str name='q'>"knee pain"</str>
<str name='hl.fl'>text</str>
<str name='qt'>standard</str>
<str name='wt'>standard</str>
<str name='hl'>on</str>
<str name='rows'>10</str>
<str name='version'>2.2</str>
</lst>
</lst>
....
<lst name='2:
http://news.prnewswire.com/DisplayReleaseContent.aspx?ACCT=ind_focus.story&amp;STORY=/www/story/09-24-2009/0005100306&amp;EDATE=
'><arr name='text'><str>I had one injection in each &lt;em>knee&lt;/em> and
my doctor said it could relieve my &lt;em>knee&lt;/em> &lt;em>pain&lt;/em>
for up to six</str>
</arr>
</lst>


Reply via email to