I think we should fix this for 2.4 (now back to 10)?
The patch of 20080908 compiles, but it is untested because of other changes pending in my working copy.
How does it fail Paul? I am trying to duplicate by returning 0 with a custom Similarity. This causes a score of 0 of course, but I don't see the failure. After applying your patch, I see the same behavior - a total score of a zero and no failure (that I can tell of course). Any hints about the problem?
The bug occurs only for the last matching doc.
The attached LUCENE-1379-test.patch adds a test case for this, the test passes with the other LUCENE-1379.patch applied, and fails on trunk.
Since this is really a corner case, it does not really matter whether it gets into 2.4 or not.
OK I now understand this patch – checking freq != 0 (as the return value) is not a valid way to return the value for next() or skipTo(), because sloppyFreq could return 0, for the last doc in the in iteration.
I will commit shortly! Thanks Paul.
For this cornercase I thought a test case would be smaller than an explanation, but you just proved me wrong.
Transmitting file data ..
Committed revision 696013.