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 Zac Smith <za...@trinkit.com> on 2011/12/04 06:43:34 UTC

How to specify dismax boost based on rating

Hi,

I think this is a pretty common requirement so hoping someone can easily point out the solution:

I have an average rating field defined in my schema that is a tdouble and can be anything from 0 - 5 (including decimals). I am using dismax so I want to define a boost based on the average rating. So the higher the number, the more it gets boosted. I am not sure how to specify the boost in my request handler. The examples I have found show something like this:
     <str name="bq">
            rating:1^1.0 rating:2^2.0 rating:3^3.0 rating:4^4.0 rating:5^5.0
        </str>

But that seems to assume I would be using whole numbers. I need my rating to take into account decimal values as well.

Any pointers?

Re: How to specify dismax boost based on rating

Posted by Erick Erickson <er...@gmail.com>.
Have you considered specifying a boost
function in your handler instead? See:
http://wiki.apache.org/solr/DisMaxQParserPlugin#bf_.28Boost_Functions.29

Best
Erick

On Sun, Dec 4, 2011 at 12:43 AM, Zac Smith <za...@trinkit.com> wrote:
> Hi,
>
> I think this is a pretty common requirement so hoping someone can easily point out the solution:
>
> I have an average rating field defined in my schema that is a tdouble and can be anything from 0 - 5 (including decimals). I am using dismax so I want to define a boost based on the average rating. So the higher the number, the more it gets boosted. I am not sure how to specify the boost in my request handler. The examples I have found show something like this:
>     <str name="bq">
>            rating:1^1.0 rating:2^2.0 rating:3^3.0 rating:4^4.0 rating:5^5.0
>        </str>
>
> But that seems to assume I would be using whole numbers. I need my rating to take into account decimal values as well.
>
> Any pointers?