--- On Mon, 3/14/11, Denis Kuzmenok <forward...@ukr.net> wrote:
> From: Denis Kuzmenok <forward...@ukr.net> > Subject: Re: Solr sorting > To: "Ahmet Arslan" <solr-user@lucene.apache.org> > Date: Monday, March 14, 2011, 12:24 PM > > > --- On Mon, 3/14/11, Denis Kuzmenok <forward...@ukr.net> > wrote: > > >> From: Denis Kuzmenok <forward...@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.