It's hard to google on _val_

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

It's hard to google on _val_

Benson Margulies
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.
Reply | Threaded
Open this post in threaded view
|

Re: It's hard to google on _val_

Yonik Seeley-2-2
On Sun, Apr 15, 2012 at 11:34 AM, Benson Margulies
<[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: It's hard to google on _val_

Benson Margulies
On Sun, Apr 15, 2012 at 12:14 PM, Yonik Seeley
<[hidden email]> wrote:

> On Sun, Apr 15, 2012 at 11:34 AM, Benson Margulies
> <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: It's hard to google on _val_

Yonik Seeley-2-2
In reply to this post by Yonik Seeley-2-2
On Sun, Apr 15, 2012 at 12:14 PM, Yonik Seeley
<[hidden email]> 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