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/06/20 15:48:07 UTC

How to highlight a field in searchresult using solr

Hi, I  want to include highlighting feature in my search application using
solr. I did necessary changes in config file for highlighting feature. when
i run the url with hl=true&hl.fl=somefield i got the <highligting>. now i
want to display these highlighted  fields in my search.jsp page. To display
the search result i am getting solr json object as

$.getJSON("http://192.168.1.9:8983/solr/db/select/?wt=json&&start=0&rows=20&q="diamond"&hl=true&hl.fl=name&json.wrf=?",
function(result){


and by parsing it displaying the result. my question is do i need to parse
<highlighting> tag separately or it will highlight the hl.fl=name
automatically

Thanks
Romi


-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-highlight-a-field-in-searchresult-using-solr-tp3086301p3086301.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to highlight a field in searchresult using solr

Posted by Romi <ro...@gmail.com>.
Jan Høydahl / Cominvent, without parsing json object for <highlighting> i am
able to show the result just using the url with hl=true and
hl.fl="somefield".  and i got the field highlighted. but what  i want is to
highlight only data  i pass in the query ,in that "somefield" not full field
data. How can i do this.

Thanks

-----
Thanks & Regards
Romi
--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-highlight-a-field-in-searchresult-using-solr-tp3086301p3089374.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to highlight a field in searchresult using solr

Posted by Jan Høydahl <ja...@cominvent.com>.
Hi,

You have asked the question before in another thread, and I have tried to answer http://search-lucene.com/m/586GL1pMaEc1

You DO need to get the highlighted result from the highlighting tag separately.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

On 20. juni 2011, at 15.48, Romi wrote:

> Hi, I  want to include highlighting feature in my search application using
> solr. I did necessary changes in config file for highlighting feature. when
> i run the url with hl=true&hl.fl=somefield i got the <highligting>. now i
> want to display these highlighted  fields in my search.jsp page. To display
> the search result i am getting solr json object as
> 
> $.getJSON("http://192.168.1.9:8983/solr/db/select/?wt=json&&start=0&rows=20&q="diamond"&hl=true&hl.fl=name&json.wrf=?",
> function(result){
> 
> 
> and by parsing it displaying the result. my question is do i need to parse
> <highlighting> tag separately or it will highlight the hl.fl=name
> automatically
> 
> Thanks
> Romi
> 
> 
> -----
> Thanks & Regards
> Romi
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-highlight-a-field-in-searchresult-using-solr-tp3086301p3086301.html
> Sent from the Solr - User mailing list archive at Nabble.com.