joining two field for query

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

joining two field for query

Ranveer Kumar-2
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
Reply | Threaded
Open this post in threaded view
|

Re: joining two field for query

iorixxx
 

> 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



     
Reply | Threaded
Open this post in threaded view
|

Re: joining two field for query

Jan Høydahl / Cominvent
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
>
>
>
>