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 Danilak Michal <mi...@prezi.com> on 2012/07/04 17:57:36 UTC

Boosting the score of the whole documents

Hi guys,
I have the following problem.

I would like to give a boost to the whole documents as I index them. I am
sending to solr the xml in the form:

<add><doc boost="2.0">....</doc></add>

But it does't seem to alter the search scores in any way. I would expect
that to multiply the final search score by two, am I correct?
Probably I would need to alter schema.xml, but I found only information on
how to do that for specific fields (just put omitNorms=false into the field
tag). But what should I do, if I want to boost the whole document?

Note: by boosting a whole document I mean, that if document A has search
score 10.0 and document B has search score 15.0 and I give document A the
boost 2.0, when I index it, I would expect its search score to be 20.0.

Thanks in advance!

Re: Boosting the score of the whole documents

Posted by Chris Hostetter <ho...@fucit.org>.
: I would like to give a boost to the whole documents as I index them. I am
: sending to solr the xml in the form:
: 
: <add><doc boost="2.0">....</doc></add>
: 
: But it does't seem to alter the search scores in any way. I would expect

http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_increase_the_score_for_specific_documents
http://wiki.apache.org/solr/UpdateXmlMessages#Optional_attributes_on_.22doc.22

http://lucene.apache.org/core/3_6_0/api/core/org/apache/lucene/search/Similarity.html#formula_norm


-Hoss

Re: Boosting the score of the whole documents

Posted by Jack Krupansky <ja...@basetechnology.com>.
I'm not completely sure. I wouldn't expect that document boost should 
require field norms, but glancing at the code, it seems that having 
omitNorms=true does mean that the score for a field will not get the 
document boost, and in fact such a field gets a "constant score". In other 
words, that the score for any field within the document will only get the 
document boost if that field does not have omitNorms=true. But as long as at 
least one field has norms, the document score should get some boost from 
document boost. I am not sure if this is the way the code is supposed to 
work, or whether it just happens to be this way.

I would hope that some committer with detailed knowledge of "norms" and 
"similarity" weigh in on this matter.
-- Jack Krupansky

-----Original Message----- 
From: Danilak Michal
Sent: Wednesday, July 04, 2012 1:11 PM
To: solr-user@lucene.apache.org
Subject: Re: Boosting the score of the whole documents

Should there be made any modification into scheme.xml file?
For example, to enable field boosts, one has to set omitNorms to false.
Is there some similar field for document boosts?

On Wed, Jul 4, 2012 at 7:29 PM, Jack Krupansky 
<ja...@basetechnology.com>wrote:

> Make sure to review the "similarity" javadoc page to understand what any
> of these factors does to the document score.
>
> See:
> http://lucene.apache.org/core/**3_6_0/api/all/org/apache/**
> lucene/search/Similarity.html<http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html>
>
> Sure, a document boost applies a multiplicative factor, but that is all
> relative to all of the other factors for that document and query. In other
> words, "all other things being equal", a doc-boost of 2.0 would double the
> score, but all other things are usually not equal.
>
> Try different doc-boost values and see how the score is affected. The
> document may have such a low score that a boost of 2.0 doesn't move the
> needle relative to other documents.
>
> I believe that the doc-boost is included within the "fieldNorm" value that
> is shown in the "explain" section if you add &debugQuery=true to your 
> query
> request. This is explained under "norm" in the similarity javadoc.
>
> I did try a couple of examples with the Solr 3.6 example, such as doc
> boost=2.0, 0.2 (de-boost), 4.0, and 8.0. In my case, it took a boost of 
> 8.0
> to move a document up.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Danilak Michal
> Sent: Wednesday, July 04, 2012 10:57 AM
> To: solr-user@lucene.apache.org
> Subject: Boosting the score of the whole documents
>
>
> Hi guys,
> I have the following problem.
>
> I would like to give a boost to the whole documents as I index them. I am
> sending to solr the xml in the form:
>
> <add><doc boost="2.0">....</doc></add>
>
> But it does't seem to alter the search scores in any way. I would expect
> that to multiply the final search score by two, am I correct?
> Probably I would need to alter schema.xml, but I found only information on
> how to do that for specific fields (just put omitNorms=false into the 
> field
> tag). But what should I do, if I want to boost the whole document?
>
> Note: by boosting a whole document I mean, that if document A has search
> score 10.0 and document B has search score 15.0 and I give document A the
> boost 2.0, when I index it, I would expect its search score to be 20.0.
>
> Thanks in advance!
> 


Re: Boosting the score of the whole documents

Posted by Danilak Michal <mi...@prezi.com>.
Should there be made any modification into scheme.xml file?
For example, to enable field boosts, one has to set omitNorms to false.
Is there some similar field for document boosts?

On Wed, Jul 4, 2012 at 7:29 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> Make sure to review the "similarity" javadoc page to understand what any
> of these factors does to the document score.
>
> See:
> http://lucene.apache.org/core/**3_6_0/api/all/org/apache/**
> lucene/search/Similarity.html<http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html>
>
> Sure, a document boost applies a multiplicative factor, but that is all
> relative to all of the other factors for that document and query. In other
> words, "all other things being equal", a doc-boost of 2.0 would double the
> score, but all other things are usually not equal.
>
> Try different doc-boost values and see how the score is affected. The
> document may have such a low score that a boost of 2.0 doesn't move the
> needle relative to other documents.
>
> I believe that the doc-boost is included within the "fieldNorm" value that
> is shown in the "explain" section if you add &debugQuery=true to your query
> request. This is explained under "norm" in the similarity javadoc.
>
> I did try a couple of examples with the Solr 3.6 example, such as doc
> boost=2.0, 0.2 (de-boost), 4.0, and 8.0. In my case, it took a boost of 8.0
> to move a document up.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Danilak Michal
> Sent: Wednesday, July 04, 2012 10:57 AM
> To: solr-user@lucene.apache.org
> Subject: Boosting the score of the whole documents
>
>
> Hi guys,
> I have the following problem.
>
> I would like to give a boost to the whole documents as I index them. I am
> sending to solr the xml in the form:
>
> <add><doc boost="2.0">....</doc></add>
>
> But it does't seem to alter the search scores in any way. I would expect
> that to multiply the final search score by two, am I correct?
> Probably I would need to alter schema.xml, but I found only information on
> how to do that for specific fields (just put omitNorms=false into the field
> tag). But what should I do, if I want to boost the whole document?
>
> Note: by boosting a whole document I mean, that if document A has search
> score 10.0 and document B has search score 15.0 and I give document A the
> boost 2.0, when I index it, I would expect its search score to be 20.0.
>
> Thanks in advance!
>

Re: Boosting the score of the whole documents

Posted by Jack Krupansky <ja...@basetechnology.com>.
Make sure to review the "similarity" javadoc page to understand what any of 
these factors does to the document score.

See:
http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html

Sure, a document boost applies a multiplicative factor, but that is all 
relative to all of the other factors for that document and query. In other 
words, "all other things being equal", a doc-boost of 2.0 would double the 
score, but all other things are usually not equal.

Try different doc-boost values and see how the score is affected. The 
document may have such a low score that a boost of 2.0 doesn't move the 
needle relative to other documents.

I believe that the doc-boost is included within the "fieldNorm" value that 
is shown in the "explain" section if you add &debugQuery=true to your query 
request. This is explained under "norm" in the similarity javadoc.

I did try a couple of examples with the Solr 3.6 example, such as doc 
boost=2.0, 0.2 (de-boost), 4.0, and 8.0. In my case, it took a boost of 8.0 
to move a document up.

-- Jack Krupansky

-----Original Message----- 
From: Danilak Michal
Sent: Wednesday, July 04, 2012 10:57 AM
To: solr-user@lucene.apache.org
Subject: Boosting the score of the whole documents

Hi guys,
I have the following problem.

I would like to give a boost to the whole documents as I index them. I am
sending to solr the xml in the form:

<add><doc boost="2.0">....</doc></add>

But it does't seem to alter the search scores in any way. I would expect
that to multiply the final search score by two, am I correct?
Probably I would need to alter schema.xml, but I found only information on
how to do that for specific fields (just put omitNorms=false into the field
tag). But what should I do, if I want to boost the whole document?

Note: by boosting a whole document I mean, that if document A has search
score 10.0 and document B has search score 15.0 and I give document A the
boost 2.0, when I index it, I would expect its search score to be 20.0.

Thanks in advance!