You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by "Roth, Matthew" <ma...@yale.edu> on 2021/04/14 20:07:37 UTC

hl.preserveMulti returns the entire field even if no match

Hi List,

I am using 7.7.3 and I have a query where I would like to use the original highlighter to look for matches in the text of the document, the title, or a multivalued tag field.

When I use hl.perserveMulti it returns the entire contents of the field because I also am using an hl.fragsize of zero. I can get around this by specifying f.TAG_NAME.hl.perserveMulti. This will only apply the perserveMutli rule to the multivalued TAG_NAME field. However, it will return the entire contents of the field even when no match. Is there a way to only return contents when there is a match to hl.q?

Ultimately, I can just ignore this and always grab the results of the highlighted field from the response. But I'd prefer to only do that if it contains a match.

Thanks,
Matt

Re: hl.preserveMulti returns the entire field even if no match

Posted by abhi Abhishek <ab...@gmail.com>.
Hi Mathew,
    Did you try hl.requireFieldMatch=true; this would force Highlighter to
only generate highlights on matched field's


Thanks,
Abhishek

On Sat, Apr 17, 2021, 13:02 Roth, Matthew <ma...@yale.edu> wrote:

> Hi List,
>
> I am using 7.7.3 and I have a query where I would like to use the original
> highlighter to look for matches in the text of the document, the title, or
> a multivalued tag field.
>
> When I use hl.perserveMulti it returns the entire contents of the field
> because I also am using an hl.fragsize of zero. I can get around this by
> specifying f.TAG_NAME.hl.perserveMulti. This will only apply the
> perserveMutli rule to the multivalued TAG_NAME field. However, it will
> return the entire contents of the field even when no match. Is there a way
> to only return contents when there is a match to hl.q?
>
> Ultimately, I can just ignore this and always grab the results of the
> highlighted field from the response. But I'd prefer to only do that if it
> contains a match.
>
> Thanks,
> Matt
>