lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: Coord issue
Date Wed, 08 Aug 2012 13:43:44 GMT
Hi Pascal!

Thanks for reporting this. I'm pretty positive its a bug in
BooleanScorer2 (i think in dualConjunctionSumScorer method). I
modified TestBoolean2.testRandomQueries to:
1. sometimes add phrase queries (so we don't get the optimized
ConjunctionTermScorer, but BooleanScorer2 for conjunctions)
2. sometimes use a Similarity with a coord of return overlap /
((float)maxOverlap - 1);

The problem is this would never be caught with the default similarity,
since due to its coord implementation it would just multiple "1" into
the score twice.
But if you customize coord, then its wrong.

I've opened https://issues.apache.org/jira/browse/LUCENE-4297

On Wed, Aug 8, 2012 at 8:47 AM, Pascal Chollet <Pascal.Chollet@local.ch> wrote:
> Hi
>
> We are using Solr 4 with a custom query tree. For boolean queries, the score should not
just be the sum of all sub-scores, but instead it should be the mean value of all the sub-scores,
which is equal to dividing the sum of the sub-scores by the number of sub-scorers.
>
> To achieve this, I wanted to use the coord factor. So I'm using a custom similarity with
the following method:
>         @Override
>         public float coord(int overlap, int maxOverlap) {
>                 return overlap == 0 ? 0 : 1.0f / overlap;
>         }
>
> After some debugging I found out, that the coord factor gets multiplied twice with the
score. Once in the BooleanScorer2:
>         @Override
>         public float score() throws IOException {
>                 coordinator.nrMatchers = 0;
>                 float sum = countingSumScorer.score();
>                 return sum * coordinator.coordFactors[coordinator.nrMatchers];
>         }
>
> and then also in ConjunctionScorer:
>         @Override
>         public float score() throws IOException {
>                 float sum = 0.0f;
>                 for (int i = 0; i < scorers.length; i++) {
>                         sum += scorers[i].score();
>                 }
>                 return sum * coord;
>         }
>
> However, if I run the query with debugQuery=on to get the explanation, the score in the
explanation gets multiplied only once with the coord factor, and thus the final score is not
the same as in the result list.
>
> To me it looks like multiplying the score twice with the coord factor is a bug. Can someone
confirm that or am I wrong?
>
> Pascal
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>



-- 
lucidimagination.com

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message