On 2 July 2014 20:32, rachun <rachun.c...@gmail.com> wrote: > Dear all, > > Could anybody suggest me how to customize the score? > So, I have data like this .. > > {ID : '0001', Title :'MacBookPro',Price: 400,Base_score:'121.2'} > {ID : '0002', Title :'MacBook',Price: 350,Base_score:'100.2'} > {ID : '0003', Title :'Laptop',Price: 300,Base_score:'155.7'} > > Notice that I have ID field for uniqueKey. > When I query q=MacBook & sort=score desc > it will return result something like this > > {ID : '0002', Title :'MacBook',Price: 350,Base_score:'100.2',score:1.45} > {ID : '0001', Title :'MacBookPro',Price: 400,Base_score:'121.2',score:1.11} > > But I want solr to produce score by also using my Base_score. The score > should be something like this > > - score = 100.2 + 1.45 = 101.65 > - score = 121.2 + 1.11 = 122.31
You should use Solr's sum function query: http://wiki.apache.org/solr/FunctionQuery#sum q=MacBook&sort=sum(Base_score, score)+desc should do it. Regards, Gora