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 Benson Margulies <bi...@gmail.com> on 2012/04/15 17:34:54 UTC

It's hard to google on _val_

So, I've been experimenting to learn how the _val_ participates in scores.

It seems to me that http://wiki.apache.org/solr/FunctionQuery should
explain the *effect* of including an _val_ term in an ordinary query,
starting with a constant.

http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_change_the_score_of_a_document_based_on_the_.2Avalue.2A_of_a_field_.28say.2C_.22popularity.22.29
poses exactly my question, but does not explain the math. It just
says, 'they get a boost'.

I tried some experiments. Positive values of _val_ did lead to
positive increments in the score, but clearly not by simple addition.

Presumably, the brains of the operation are
http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/scoring.html.
However, it seems to me that it would be kind to us dumb animals if
the Solr pages gave a 'for idiots' summary of the net effect. Left to
my own devices, I'll eventually work my way through this, but if
someone hands me a shortcut, I'll cheerfully play tech writer here and
there.

Re: It's hard to google on _val_

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Sun, Apr 15, 2012 at 12:14 PM, Yonik Seeley
<yo...@lucidimagination.com> wrote:
> That's just because Lucene "normalizes" scores.  By default, this is
> really just multiplying scores by a magic constant (that by default is
> the inverse of the sum of squared weights)

Sorry... I missed the square root.   Should be "inverse of the square
root of the sum of squared weights".
See DefaultSimilarity.queryNorm:

  public float queryNorm(float sumOfSquaredWeights) {
    return (float)(1.0 / Math.sqrt(sumOfSquaredWeights));
  }

-Yonik
lucenerevolution.com - Lucene/Solr Open Source Search Conference.
Boston May 7-10

Re: It's hard to google on _val_

Posted by Benson Margulies <bi...@gmail.com>.
On Sun, Apr 15, 2012 at 12:14 PM, Yonik Seeley
<yo...@lucidimagination.com> wrote:
> On Sun, Apr 15, 2012 at 11:34 AM, Benson Margulies
> <bi...@gmail.com> wrote:
>> So, I've been experimenting to learn how the _val_ participates in scores.
>>
>> It seems to me that http://wiki.apache.org/solr/FunctionQuery should
>> explain the *effect* of including an _val_ term in an ordinary query,
>> starting with a constant.
>
> It's simply added to the score as any other clause in a boolean query would be.
>
>> Positive values of _val_ did lead to
>> positive increments in the score, but clearly not by simple addition.
>
> That's just because Lucene "normalizes" scores.  By default, this is
> really just multiplying scores by a magic constant (that by default is
> the inverse of the sum of squared weights) and doesn't change relative
> orderings of docs.  If you add debugQuery=true and look at the scoring
> explanations, you'll see that queryNorm component.
>
> If you want to go down the rabbit hole on trunk, see
> IndexSearcher.createNormalizedWeight()

I think I should be able to add some text to the wiki that would help
fellow Alice's merely by looking at the debugQuery result. Thanks.


>
> -Yonik
> lucenerevolution.com - Lucene/Solr Open Source Search Conference.
> Boston May 7-10

Re: It's hard to google on _val_

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Sun, Apr 15, 2012 at 11:34 AM, Benson Margulies
<bi...@gmail.com> wrote:
> So, I've been experimenting to learn how the _val_ participates in scores.
>
> It seems to me that http://wiki.apache.org/solr/FunctionQuery should
> explain the *effect* of including an _val_ term in an ordinary query,
> starting with a constant.

It's simply added to the score as any other clause in a boolean query would be.

> Positive values of _val_ did lead to
> positive increments in the score, but clearly not by simple addition.

That's just because Lucene "normalizes" scores.  By default, this is
really just multiplying scores by a magic constant (that by default is
the inverse of the sum of squared weights) and doesn't change relative
orderings of docs.  If you add debugQuery=true and look at the scoring
explanations, you'll see that queryNorm component.

If you want to go down the rabbit hole on trunk, see
IndexSearcher.createNormalizedWeight()

-Yonik
lucenerevolution.com - Lucene/Solr Open Source Search Conference.
Boston May 7-10