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 Ranveer Kumar <ra...@gmail.com> on 2010/02/09 12:31:00 UTC

joining two field for query

Hi all,

I need logic in solr to join two field in query;
I indexed two field : id and body(text type).

5 rows are indexed:
id=1 : text= nokia samsung....
id=2 : text= sony vaio nokia samsung....
id=3 : text= vaio nokia....
etc..

I am searching by "q=id:1" returning result perfectly, returning "nokia
samsung".

I am searching by "nokia" and resulting (listing) 1,2,3 field with short
description.
There is link on search list(like google), by clicking on link performing
new search (opening doc from index), for this search

I want to join two fields:
id:1 + queryString ("nokia samsung") to return only id:1 record and want to
highlight the field "nokia samsung".
something like : "q=id:1 + body:nokia samsung"

basically I want to highlight the query string when clicking on link and
opening the new windows (like google cache).

please help..
thanks

Re: joining two field for query

Posted by Jan Høydahl / Cominvent <ja...@cominvent.com>.
You may also want to play with other highlighting parameters to select how much text to do highlighting on, how many fragments etc. See http://wiki.apache.org/solr/HighlightingParameters

--
Jan Høydahl  - search architect
Cominvent AS - www.cominvent.com

On 9. feb. 2010, at 13.08, Ahmet Arslan wrote:

> 
>> I am searching by "nokia" and resulting (listing) 1,2,3
>> field with short
>> description.
>> There is link on search list(like google), by clicking on
>> link performing
>> new search (opening doc from index), for this search
>> 
>> I want to join two fields:
>> id:1 + queryString ("nokia samsung") to return only id:1
>> record and want to
>> highlight the field "nokia samsung".
>> something like : "q=id:1 + body:nokia samsung"
>> 
>> basically I want to highlight the query string when
>> clicking on link and
>> opening the new windows (like google cache).
> 
> When the user clicks document (id=1), you can use these parameters:
> q=body:(nokia samsung)&fq=id:1&hl=true&hl.fl=body
> 
> 
> 
> 


Re: joining two field for query

Posted by Ahmet Arslan <io...@yahoo.com>.
 
> I am searching by "nokia" and resulting (listing) 1,2,3
> field with short
> description.
> There is link on search list(like google), by clicking on
> link performing
> new search (opening doc from index), for this search
> 
> I want to join two fields:
> id:1 + queryString ("nokia samsung") to return only id:1
> record and want to
> highlight the field "nokia samsung".
> something like : "q=id:1 + body:nokia samsung"
> 
> basically I want to highlight the query string when
> clicking on link and
> opening the new windows (like google cache).

When the user clicks document (id=1), you can use these parameters:
q=body:(nokia samsung)&fq=id:1&hl=true&hl.fl=body