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 aster <bp...@gmail.com> on 2011/06/29 02:22:57 UTC

How to Create a weighted function (dismax or otherwise)

I am trying to create a feature that allows search results to be displayed by
this formula sum(weight1*text relevance score, weight2 * price). weight1 and
weight2 are numeric values that can be changed to influence the search
results.

I am sending the following query params to the Solr instance for searching.

q=red
defType=dismax
qf=10^name+2^price

My understanding is that when using dismax, Solr/Lucene looks for the search
text in all the fields specified in the "qf" param.

Currently my search results are similar to those I get when "qf" does not
including a price. I think this is because price is a numeric field and
there is not text match.

Is it possible to rank search results based on this formula -
sum(weight1*text relevance score, weight2 * price).

Thanks!

--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-Create-a-weighted-function-dismax-or-otherwise-tp3119977p3119977.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to Create a weighted function (dismax or otherwise)

Posted by aster <bp...@gmail.com>.
Are there any best practices or preferred ways to accomplish what I am
trying? 

Do the params for defType, qf and bf belong in a solr request handler? 

Is it possible to have the weights as variables so they can be tweaked till
we find the optimum balance in showing our results?

Thanks!

--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-Create-a-weighted-function-dismax-or-otherwise-tp3119977p3122630.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to Create a weighted function (dismax or otherwise)

Posted by rulinma <ru...@gmail.com>.
good.



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-Create-a-weighted-function-dismax-or-otherwise-tp3119977p4138401.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to Create a weighted function (dismax or otherwise)

Posted by rulinma <ru...@gmail.com>.
good



--
View this message in context: http://lucene.472066.n3.nabble.com/How-to-Create-a-weighted-function-dismax-or-otherwise-tp3119977p4138411.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: How to Create a weighted function (dismax or otherwise)

Posted by Ahmet Arslan <io...@yahoo.com>.
> I am trying to create a feature that
> allows search results to be displayed by
> this formula sum(weight1*text relevance score, weight2 *
> price). weight1 and
> weight2 are numeric values that can be changed to influence
> the search
> results.
> 
> I am sending the following query params to the Solr
> instance for searching.
> 
> q=red
> defType=dismax
> qf=10^name+2^price

Correct syntax of qf and pf is fieldName^boostFactor, i.e, 
qf=name^10 price^2

However your query is a word, so it won't match in price field. I assume price field is numeric. 

You can simulate sum(weight1*text relevance score, weight2 * price).
with bf parameter and FunctionQueries. 

q=red&defTypeedismax&qf=name&bf=product(price,w1/w2)

http://wiki.apache.org/solr/FunctionQuery
http://wiki.apache.org/solr/DisMaxQParserPlugin#bf_.28Boost_Functions.29