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 Denis Kuzmenok <fo...@ukr.net> on 2011/03/14 09:23:56 UTC

Solr sorting

Hi.
Is there any way to make such scheme working:
I  have  many  documents,  each  has  a  random field to enable random
sorting,  and  i  have  a weight field.
I  want to get random results, but documents with bigger weight should
appear more frequently.

Is that possible?

Thanks, in advance.


Re: Solr sorting

Posted by Ahmet Arslan <io...@yahoo.com>.

--- On Mon, 3/14/11, Denis Kuzmenok <fo...@ukr.net> wrote:

> From: Denis Kuzmenok <fo...@ukr.net>
> Subject: Re: Solr sorting
> To: "Ahmet Arslan" <so...@lucene.apache.org>
> Date: Monday, March 14, 2011, 12:24 PM
> 
> > --- On Mon, 3/14/11, Denis Kuzmenok <fo...@ukr.net>
> wrote:
> 
> >> From: Denis Kuzmenok <fo...@ukr.net>
> >> Subject: Solr sorting
> >> To: solr-user@lucene.apache.org
> >> Date: Monday, March 14, 2011, 10:23 AM
> >> Hi.
> >> Is there any way to make such scheme working:
> >> I  have  many  documents,  each 
> >> has  a  random field to enable random
> >> sorting,  and  i  have  a weight
> >> field.
> >> I  want to get random results, but documents
> with
> >> bigger weight should
> >> appear more frequently.
> 
> 
> > You can use http://wiki.apache.org/solr/FunctionQuery
> > An example can be :
> &sort=product(random_123,weight)
> > But this requires solr3.1 or trunk.
> > With 1.4.1 you can use _val_ hook :
> > &q=_val_:"product(random_78,weight)"
> 
> Tried  this.  Tried  to make query with one
> category on documents. Top
> documents  have  weight  about 1700, 1000,
> 800, 600. And therefore top
> document  always  hits  in  top 
> position  :(  There  should  be 
> some
> limitations or something for the weight field values, i
> guess..

I thought that's what you are after, since you said documents with
bigger weight should appear more frequently. May be you can increase weight of random value? something like: random_123*0.8 + weight*0.2

Some people can do magic with functions like map, scale and query.


      

Re: Solr sorting

Posted by Denis Kuzmenok <fo...@ukr.net>.
> --- On Mon, 3/14/11, Denis Kuzmenok <fo...@ukr.net> wrote:

>> From: Denis Kuzmenok <fo...@ukr.net>
>> Subject: Solr sorting
>> To: solr-user@lucene.apache.org
>> Date: Monday, March 14, 2011, 10:23 AM
>> Hi.
>> Is there any way to make such scheme working:
>> I  have  many  documents,  each 
>> has  a  random field to enable random
>> sorting,  and  i  have  a weight
>> field.
>> I  want to get random results, but documents with
>> bigger weight should
>> appear more frequently.


> You can use http://wiki.apache.org/solr/FunctionQuery
> An example can be : &sort=product(random_123,weight)
> But this requires solr3.1 or trunk.
> With 1.4.1 you can use _val_ hook :
> &q=_val_:"product(random_78,weight)"

Tried  this.  Tried  to make query with one category on documents. Top
documents  have  weight  about 1700, 1000, 800, 600. And therefore top
document  always  hits  in  top  position  :(  There  should  be  some
limitations or something for the weight field values, i guess..





Re: Solr sorting

Posted by Ahmet Arslan <io...@yahoo.com>.
--- On Mon, 3/14/11, Denis Kuzmenok <fo...@ukr.net> wrote:

> From: Denis Kuzmenok <fo...@ukr.net>
> Subject: Solr sorting
> To: solr-user@lucene.apache.org
> Date: Monday, March 14, 2011, 10:23 AM
> Hi.
> Is there any way to make such scheme working:
> I  have  many  documents,  each 
> has  a  random field to enable random
> sorting,  and  i  have  a weight
> field.
> I  want to get random results, but documents with
> bigger weight should
> appear more frequently.


You can use http://wiki.apache.org/solr/FunctionQuery

An example can be : &sort=product(random_123,weight)

But this requires solr3.1 or trunk.

With 1.4.1 you can use _val_ hook : &q=_val_:"product(random_78,weight)"