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 Indika Tantrigoda <in...@gmail.com> on 2010/07/03 16:31:29 UTC

Boosting based on field values

Hello all,

I'd like to know if its possible to boost the score of documents based on a
field value.
Ex. My schema has a field called isFeatured, and if the value of the field
is true or "1" I'd like to
have these documents come first in a query result regardless of the score.

Thanks in advance.

Regards,
Indika

Re: Boosting based on field values

Posted by Erick Erickson <er...@gmail.com>.
Wouldn't sorting work in this situation as well?

Erick

On Sun, Jul 4, 2010 at 8:54 AM, Indika Tantrigoda <in...@gmail.com>wrote:

> Hi,
>
> {!boost b=pow(10000,featured_listing)} is the boost function I used.
>
> Got the results as expected.
>
> Thanks.
>
> Regards,
> Indika
>
>
> On 3 July 2010 21:10, Indika Tantrigoda <in...@gmail.com> wrote:
>
> > Thanks for the info. I'll try this out.
> >
> > Regards,
> > Indika
> >
> >
> > On 3 July 2010 20:48, Ahmet Arslan <io...@yahoo.com> wrote:
> >
> >> > I'd like to know if its possible to boost the score of
> >> > documents based on a
> >> > field value. Ex. My schema has a field called isFeatured, and if the
> >> > value of the field
> >> > is true or "1" I'd like to
> >> > have these documents come first in a query result
> >> > regardless of the score.
> >>
> >> Yes it is possible. http://wiki.apache.org/solr/FunctionQuery
> >>
> >>
> http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
> >>
> >> Something like:
> >> &q={!boost b=pow(x,abs(sub(isFeatured,1)),0.5)}yourQuery
> >>
> >>
> >>
> >>
> >>
> >
>

Re: Boosting based on field values

Posted by Indika Tantrigoda <in...@gmail.com>.
Hi,

{!boost b=pow(10000,featured_listing)} is the boost function I used.

Got the results as expected.

Thanks.

Regards,
Indika


On 3 July 2010 21:10, Indika Tantrigoda <in...@gmail.com> wrote:

> Thanks for the info. I'll try this out.
>
> Regards,
> Indika
>
>
> On 3 July 2010 20:48, Ahmet Arslan <io...@yahoo.com> wrote:
>
>> > I'd like to know if its possible to boost the score of
>> > documents based on a
>> > field value. Ex. My schema has a field called isFeatured, and if the
>> > value of the field
>> > is true or "1" I'd like to
>> > have these documents come first in a query result
>> > regardless of the score.
>>
>> Yes it is possible. http://wiki.apache.org/solr/FunctionQuery
>>
>> http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
>>
>> Something like:
>> &q={!boost b=pow(x,abs(sub(isFeatured,1)),0.5)}yourQuery
>>
>>
>>
>>
>>
>

Re: Boosting based on field values

Posted by Indika Tantrigoda <in...@gmail.com>.
Thanks for the info. I'll try this out.

Regards,
Indika

On 3 July 2010 20:48, Ahmet Arslan <io...@yahoo.com> wrote:

> > I'd like to know if its possible to boost the score of
> > documents based on a
> > field value. Ex. My schema has a field called isFeatured, and if the
> > value of the field
> > is true or "1" I'd like to
> > have these documents come first in a query result
> > regardless of the score.
>
> Yes it is possible. http://wiki.apache.org/solr/FunctionQuery
>
> http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents
>
> Something like:
> &q={!boost b=pow(x,abs(sub(isFeatured,1)),0.5)}yourQuery
>
>
>
>
>

Re: Boosting based on field values

Posted by Ahmet Arslan <io...@yahoo.com>.
> I'd like to know if its possible to boost the score of
> documents based on a
> field value. Ex. My schema has a field called isFeatured, and if the
> value of the field
> is true or "1" I'd like to
> have these documents come first in a query result
> regardless of the score.

Yes it is possible. http://wiki.apache.org/solr/FunctionQuery
http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_boost_the_score_of_newer_documents

Something like:
&q={!boost b=pow(x,abs(sub(isFeatured,1)),0.5)}yourQuery