How to prevent solr from highlighting unmatched terms?

67 views Asked by At

I have a complex query with several terms "OR"d together. I am getting the correct documents returned, but the highlights include the terms which did not match. For example, a query like this:

text: (cat OR (dog AND ohio))

will match documents containing "cat" but not "ohio". The problems is that it will highlight "dog" in that document even though "dog" only appears in the "dog AND ohio" clause, which does not match the current document.

Is there some way to restrict the highlighter to only highlight terms from successfully matched clauses?

0

There are 0 answers