lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pascal Chollet <>
Subject Coord issue
Date Wed, 08 Aug 2012 12:47:27 GMT

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:
	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:
	public float score() throws IOException {
		coordinator.nrMatchers = 0;
		float sum = countingSumScorer.score();
		return sum * coordinator.coordFactors[coordinator.nrMatchers];

and then also in ConjunctionScorer:
	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?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message