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 Umang Agrawal <um...@gmail.com> on 2015/03/23 15:58:59 UTC

How to boost records based on score than a custom field rank (double field)

Hi All

How can we boost the solr records at query time based on score (calculated
by solr search engine) then by a custom field rank (a double field
available in record).

I have dolr documents containing fields "id", "title", "headline",
"summary", "rank".
Where
    id is string
    title is string
    headline is string
    summary is string
    rank is double

Score calculated by:
    query field (qf) = title^10 headline^5 summary^1

I want to boost the records based on score and rank.

I tried with sort by score (desc) then rank (desc) but it's not working as
expected, since sorting remove the score assignment by solr search engine.

-- 
Thanx & Regards
Umang Agrawal

Re: How to boost records based on score than a custom field rank (double field)

Posted by Erick Erickson <er...@gmail.com>.
Function queries are built for this, see:
https://cwiki.apache.org/confluence/display/solr/Function+Queries, the
_val_ trick (that's underscore-val-underscore in case italics happen).

You can also wrap that value in any of the other functions.

Best,
Erick

On Mon, Mar 23, 2015 at 7:58 AM, Umang Agrawal <um...@gmail.com> wrote:
> Hi All
>
> How can we boost the solr records at query time based on score (calculated
> by solr search engine) then by a custom field rank (a double field
> available in record).
>
> I have dolr documents containing fields "id", "title", "headline",
> "summary", "rank".
> Where
>     id is string
>     title is string
>     headline is string
>     summary is string
>     rank is double
>
> Score calculated by:
>     query field (qf) = title^10 headline^5 summary^1
>
> I want to boost the records based on score and rank.
>
> I tried with sort by score (desc) then rank (desc) but it's not working as
> expected, since sorting remove the score assignment by solr search engine.
>
> --
> Thanx & Regards
> Umang Agrawal