Highlighting in Solr 1.4 - requireFieldMatch

Posted by Mark Redding on Stack Overflow See other posts from Stack Overflow or by Mark Redding
Published on 2010-03-30T21:07:42Z Indexed on 2010/03/30 21:23 UTC
Read the original article Hit count: 376

Filed under:
|
|
|

I have an object

Title   : foo
Summary : foo bar
Body    : this is a published story about a foo and a bar

All three are set up as fields with stored=true.

The user searches across my system for the word

"foo"

I would like to highlight foo in all three places.

The user searches for the word foo in the title

"title:foo"

I only want to highlight foo within the title.

When I added hl.requireFieldMatch=true and hl.usePhraseHighlighter=true as part of my query over to SOLR I am unable to get the highlighting in all three places when doing a generic non fielded search. Is there a way to get both scenarios to work?

I had these two items turned off, but I am adding in some fielded portions of the query that the user does not see which only display Published items for instance. the problem is

(foo AND status:published)

is causing the word published in the body to highlight when the user only searched for the word "foo".

© Stack Overflow or respective owner

Related posts about solr

Related posts about lucene