Reputation: 439
Background:
1 - I'm using WebSolr for this search. 2 - I have two fields stored in websolr - name and id.
I want to search for these entries based on name AND boost the search score based on this criteria:
if id in [x1,x2..xN] then +2
if id in [y1,y2..yN] then +1
else +0
From my research, the answer lies in the following - Function query, or - DisMaxQParser
I have looked at the documentation but IMO its not very comprehensive.
Any help is appreciated.
Upvotes: 0
Views: 355
Reputation: 7944
In addition to hkn's approach, you could also use DisMax query parser boost queries:
q=queryString
&defType=dismax
&qf=…
&bq=id:[x1+TO+xN]^3
&bq=id:[y1+TO+yN]^2
(Untested, but should convey the idea.)
Upvotes: 0
Reputation: 1448
You can use boosts. Try a query like
name:searchString AND ( id:[x1 TO xN] ^2 OR id:[y1 TO yN]^1)
Upvotes: 1