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 Romi <ro...@gmail.com> on 2011/07/06 09:27:13 UTC

Highlight whole query phrase

i am using solr for search and i implemented highlighting feature for my
search results. when i my search string is ring it highlight ring but when
search string is "gold ring" than also it highlight only gold, where i
wanted to highlight whole gold ring for highlighting i use description field
which i got as 
*
highlighting ={
        "8252": {
            "text": [
                " and <em>gold</em><em>Ring</em>  design was finely crafted
in Japan."
            ]
        },
        "8142": {
            "text": [
                "This <em>elegant</em> <em>Ring</em>  has an Akoya cultured
pearl with a band of bezel-set round diamonds making"
            ]
        }
    };*


Now i am parsing it as
*
$.each(newresult.response.docs, function(i,item){
   var word = highlight[item["UID_PK"]];
   var result="";
   var j=0;
   for (j=0 ;j<=item.text.length;j++)
   {
    result = result+item.text[j]+"<br>";
   }
                                result=result.replace(word,'<em>' + word +
'</em>');
});
*

Now how should i parse so that i got gold ring highlighted 


-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/Highlight-whole-query-phrase-tp3143797p3143797.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Highlight whole query phrase

Posted by Romi <ro...@gmail.com>.
it is accidentally became elegant. anyway i got the solution without using
hl.mergeContiguous , because its not working.
look at http://jsfiddle.net/bhXbh/31/ for the solution

-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/Highlight-whole-query-phrase-tp3143797p3144575.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Highlight whole query phrase

Posted by Marian Steinbach <ma...@sendung.de>.
On Wed, Jul 6, 2011 at 12:07, Romi <ro...@gmail.com> wrote:
> I included hl.mergeContiguous parameter. in my url but no effect on search
> result highlighting.
> actually i need to parse highlighting property. please look at
> http://jsfiddle.net/bhXbh/4/

I just noticed that I actually don't understand what problem you are
trying to solve.

The code snippet in your first mail has one example (" and
<em>gold</em><em>Ring</em>  design") where both "gold" and "ring" are
highlighted. So this should be what you need. (Don't know about the
second one, where it also highlights "elegant".)

Marian

Re: Highlight whole query phrase

Posted by Romi <ro...@gmail.com>.
I included hl.mergeContiguous parameter. in my url but no effect on search
result highlighting.
actually i need to parse highlighting property. please look at
http://jsfiddle.net/bhXbh/4/


-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/Highlight-whole-query-phrase-tp3143797p3144157.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Highlight whole query phrase

Posted by Marian Steinbach <ma...@sendung.de>.
On Wed, Jul 6, 2011 at 09:27, Romi <ro...@gmail.com> wrote:
>
> Now how should i parse so that i got gold ring highlighted
>

Take a look at the hl.mergeContiguous parameter.

http://wiki.apache.org/solr/HighlightingParameters#hl.mergeContiguous