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 Brian Lamb <br...@journalexperts.com> on 2011/03/14 16:40:42 UTC

Dynamically boost search scores

Hi all,

I have a field in my schema called boost_score. I would like to set it up so
that if I pass in a certain flag, each document score is boosted by the
number in boost_score.

For example if I use:

http://localhost/solr/search/?q=dog

I would get search results like normal. But if I use:

http://localhost/solr/search?q=dog&boost=true

The score of each document would be boosted by the number in the field
boost_score.

Unfortunately, I have no idea how to implement this actually but I'm hoping
that's where you all can come in.

Thanks,

Brian Lamb

Re: Dynamically boost search scores

Posted by Ahmet Arslan <io...@yahoo.com>.
> the page you recommended and came up
> with:
> 
> http://localhost:8983/solr/search/?q=dog&fl=boost_score,genus,species,score&rows=15&bf=%22ord%28sum%28boost_score,1%29%29
> ^10%22
> 
> But appeared to have no effect. The results were in the
> same order as they
> were when I left off the bf parameter. So what am I doing
> incorrectly?

bf belongs to DisMaxParams. 

Instead try this  q={!boost b=boost_score}dog

You can use any valid FuctionQuery as a b paramter.

http://lucene.apache.org/solr/api/org/apache/solr/search/BoostQParserPlugin.html

You may want to use parameter referencing also. Where q is harcoded in solrconfig.xml, something like:

q={!boost b=$bb v=$qq}&qq=dog&bb=%22ord%28sum%28boost_score,1%29%29

http://wiki.apache.org/solr/LocalParams



      

Re: Dynamically boost search scores

Posted by Brian Lamb <br...@journalexperts.com>.
Thank you for the advice. I looked at the page you recommended and came up
with:

http://localhost:8983/solr/search/?q=dog&fl=boost_score,genus,species,score&rows=15&bf=%22ord%28sum%28boost_score,1%29%29
^10%22

But appeared to have no effect. The results were in the same order as they
were when I left off the bf parameter. So what am I doing incorrectly?

Thanks,

Brian Lamb

On Mon, Mar 14, 2011 at 11:45 AM, Markus Jelsma
<ma...@openindex.io>wrote:

> See boosting documents by function query. This way you can use document's
> boost_score field to affect the final score.
>
> http://wiki.apache.org/solr/FunctionQuery
>
> On Monday 14 March 2011 16:40:42 Brian Lamb wrote:
> > Hi all,
> >
> > I have a field in my schema called boost_score. I would like to set it up
> > so that if I pass in a certain flag, each document score is boosted by
> the
> > number in boost_score.
> >
> > For example if I use:
> >
> > http://localhost/solr/search/?q=dog
> >
> > I would get search results like normal. But if I use:
> >
> > http://localhost/solr/search?q=dog&boost=true
> >
> > The score of each document would be boosted by the number in the field
> > boost_score.
> >
> > Unfortunately, I have no idea how to implement this actually but I'm
> hoping
> > that's where you all can come in.
> >
> > Thanks,
> >
> > Brian Lamb
>
> --
> Markus Jelsma - CTO - Openindex
> http://www.linkedin.com/in/markus17
> 050-8536620 / 06-50258350
>

Re: Dynamically boost search scores

Posted by Markus Jelsma <ma...@openindex.io>.
See boosting documents by function query. This way you can use document's 
boost_score field to affect the final score.

http://wiki.apache.org/solr/FunctionQuery

On Monday 14 March 2011 16:40:42 Brian Lamb wrote:
> Hi all,
> 
> I have a field in my schema called boost_score. I would like to set it up
> so that if I pass in a certain flag, each document score is boosted by the
> number in boost_score.
> 
> For example if I use:
> 
> http://localhost/solr/search/?q=dog
> 
> I would get search results like normal. But if I use:
> 
> http://localhost/solr/search?q=dog&boost=true
> 
> The score of each document would be boosted by the number in the field
> boost_score.
> 
> Unfortunately, I have no idea how to implement this actually but I'm hoping
> that's where you all can come in.
> 
> Thanks,
> 
> Brian Lamb

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350