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 solrdude <yo...@searchreviews.com> on 2011/11/02 22:44:59 UTC

Highlighting "text" field when query is for "string" field

I have situation where I need to highlight matching phrases in "text" field
where as query is against "string" field. Its not highlighting now, may be
because in text field they are all terms and hence not a match for phrase.
How do i do it? With hl.alternateField, it identifies those things in
<highlighting> field, but not applying default <em> around matching phrase.
How do I get it to mark it?

Eg:
<doc>
<str name="keyword_text">smooth skin</str>  // field type: string
<str name="excerpt">Smooth skin</str>    // field type: text
</doc>

query:
http://localhost:8080/mycore/select?facet=true&group.ngroups=true&facet.mincount=1&group.limit=3&facet.limit=10&hl=true&rows=10&version=2&start=0&q=keyword:%22smooth+skin%22+and+publishStatus:Live&group.field=productName&group=true&facet.field=brand&hl.fl=excerpt&hl.alternateField=excerpt

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/Highlighting-text-field-when-query-is-for-string-field-tp3475334p3475334.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Highlighting "text" field when query is for "string" field

Posted by solrdude <yo...@searchreviews.com>.
Or is it because query is on "keyword" field and I expect matching keywords
to be highlighted on "excerpts" field? Any insights would help a lot.

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/Highlighting-text-field-when-query-is-for-string-field-tp3475334p3814159.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Highlighting "text" field when query is for "string" field

Posted by solrdude <yo...@searchreviews.com>.
Just to be clear, I do phrase query on string field like
q=keyword_text:"smooth skin". I am expecting highlighting to be done on
excerpt field. What I see is:

<lst name="highlighting">
<lst name="18602-1973"/>
<lst name="18603-1973"/>
<lst name="18604-1973"/>
</lst>

These numbers are unique id's of documents. Where is excerpts with
highlighted text? Any idea?

Thanks

--
View this message in context: http://lucene.472066.n3.nabble.com/Highlighting-text-field-when-query-is-for-string-field-tp3475334p3668074.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Highlighting "text" field when query is for "string" field

Posted by Erick Erickson <er...@gmail.com>.
Try this with &debugQuery=on. I suspect you're not getting the query you
think you are and I'd straighten that out before worrying about highlighting.

Usually, for instance, AND should be capitalized to be an operator.

So try with &debugQuery=on and see what happens. The highlighter, I
believe, will try to highlight on all returned fields by default so it *should*
work.

And I assume you're setting 'stored="true" ' on your excerpt field?

Best
Erick

On Wed, Nov 2, 2011 at 5:44 PM, solrdude <yo...@searchreviews.com> wrote:
> I have situation where I need to highlight matching phrases in "text" field
> where as query is against "string" field. Its not highlighting now, may be
> because in text field they are all terms and hence not a match for phrase.
> How do i do it? With hl.alternateField, it identifies those things in
> <highlighting> field, but not applying default <em> around matching phrase.
> How do I get it to mark it?
>
> Eg:
> <doc>
> <str name="keyword_text">smooth skin</str>  // field type: string
> <str name="excerpt">Smooth skin</str>    // field type: text
> </doc>
>
> query:
> http://localhost:8080/mycore/select?facet=true&group.ngroups=true&facet.mincount=1&group.limit=3&facet.limit=10&hl=true&rows=10&version=2&start=0&q=keyword:%22smooth+skin%22+and+publishStatus:Live&group.field=productName&group=true&facet.field=brand&hl.fl=excerpt&hl.alternateField=excerpt
>
> Thanks
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Highlighting-text-field-when-query-is-for-string-field-tp3475334p3475334.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>