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-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to