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 kolesman <al...@gmail.com> on 2010/12/01 03:38:48 UTC

Troubles with forming query for solr.

Hi,

I have some troubles with forming query for solr.

Here is my task :
I'm indexing objects with 3 fields, for example {field1, field2, filed3}
In solr's response I want to get object in special order :
1. Firstly I want to get objects where all 3 fields are matched
2. Then I want to get objects where ONLY field1 and field2 are matched
3. And finnally I want to get objects where ONLY field2 and field3 are
matched.

Could your explain me how to form query for my task?
-- 
View this message in context: http://lucene.472066.n3.nabble.com/Troubles-with-forming-query-for-solr-tp1996630p1996630.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Troubles with forming query for solr.

Posted by Savvas-Andreas Moysidis <sa...@googlemail.com>.
Hello,

would something similar along those lines:
(field1:term AND field2:term AND field3:term)^2 OR (field1:term AND
field2:term)^0.8 OR (field2:term AND field3:term)^0.5

work? You'll probably need to experiment with the boost values to get the
desired result.

Another option could be investigating the Dismax handler.

On 1 December 2010 02:38, kolesman <al...@gmail.com> wrote:

>
> Hi,
>
> I have some troubles with forming query for solr.
>
> Here is my task :
> I'm indexing objects with 3 fields, for example {field1, field2, filed3}
> In solr's response I want to get object in special order :
> 1. Firstly I want to get objects where all 3 fields are matched
> 2. Then I want to get objects where ONLY field1 and field2 are matched
> 3. And finnally I want to get objects where ONLY field2 and field3 are
> matched.
>
> Could your explain me how to form query for my task?
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Troubles-with-forming-query-for-solr-tp1996630p1996630.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>