> FYI, Nutch uses Query.setBoost(0.0f) to add clauses which affect the
> set of results but not their ranking. In particular, it uses this to
> automatically convert query clauses into filters, so that query
> clauses like "lang:en" can be implemented as cached filters. Note
> that not all such clauses are so optimized.
Thanks for the hint, Doug. OK, I understand how you use boost=0.0f in
Nutch. Quite cool and elegant idea actually!
I guess then throwing an IllegalArgumentException in case boost=0 would
break this. The question remains if we should fix the scorers to never
return NaN. Hmm, I'm not completely sure how to do this. Maybe
DefaultSimilarity.queryNorm() should return 0 instead of Infinity in
case sumOfSquaredWeights is 0. But then with custom Similarity
implemenations we could still end up getting NaN.
A different solution of course is to fix it in the scorers itself, to
return a score of 0 in case boost is 0. But then we'd have to add
checks in the score() and explain() methods, which might be a
So I'm not sure if we should "fix" this at all considering these
difficulties and the fact that nobody complained (I think?) about the
NaN so far.
Anyway, I'll go ahead and commit
LUCENE-698 since this NaN problem is a
separate issue and not only happing for the FilteredQuery.