The only thing I can think of is to post-process your snippets.  I.E. pull the 
highlighting tags out of the strings, look for the match in your result 
"description" field looking for a match, and if you find one, replace that 
"description" with the original highlight text (i.e. with the highlight tags 
still in place).

Bob Sandiford | Lead Software Engineer | SirsiDynix
P: 800.288.8020 X6943 | bob.sandif...@sirsidynix.com
www.sirsidynix.com 
Join the conversation - you may even get an iPad or Nook out of it!

Like us on Facebook!

Follow us on Twitter!



> -----Original Message-----
> From: Jeffrey Chang [mailto:jclal...@gmail.com]
> Sent: Friday, May 27, 2011 12:16 AM
> To: solr-user@lucene.apache.org
> Subject: Re: highlighting in multiValued field
> 
> Hi Bob,
> 
> I have no idea how I missed that! Thanks for pointing me to use
> hl.snippets
> - that did the magic!
> 
> Please allow me squeeze one more question along the same line.
> 
> Since I'm now able to display multiple snippets - what I'm trying to
> achieve
> is, determine which highlighted snippet maps back to what position in
> the
> original document.
> 
> e.g. If I search for "Tel", with highlighting and hl.snippets=2 it'll
> return
> me:
> <doc>
> ...
> <arr name="descID">
>   <str>1</str>
>   <str>2</str>
>   <str>3</str>
> </arr>
> <arr name="description">
>   <str>Tel to talent 1</str>
>   <str>Tel to talent 2</str>
>   <str>Tel to talent 3</str>
> </arr>
> ...
> </doc>
> <lst name="highlighting">
>   <lst name="1">
>   <arr name="description">
>     <str><em>Tel</em> to talent 1</str>
>     <str><em>Tel</em> to talent 2</str>
>   </arr>
> </lst>
> ...
> 
> Is there a way for me to figure out which highlighted snippet belongs
> to
> which descID so I can display also display the non-highlighted rows for
> my
> search results.
> 
> Or is this not the way how highlighting is designed and to be used?
> 
> Thanks so much,
> Jeff
> [snip]

Reply via email to