mirror of https://github.com/apache/lucene.git
LUCENE-6338: s/skipTo/advance/ and removed duplicate assertion.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1664279 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
de381d2816
commit
a275ca2bb5
|
@ -93,8 +93,7 @@ public class AssertingScorer extends Scorer {
|
|||
public float score() throws IOException {
|
||||
assert iterating();
|
||||
final float score = in.score();
|
||||
assert !Float.isNaN(score);
|
||||
assert !Float.isNaN(score);
|
||||
assert !Float.isNaN(score) : "NaN score for in="+in;
|
||||
return score;
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ public class QueryUtils {
|
|||
return new AllDeletedFilterReader(LuceneTestCase.getOnlySegmentReader(reader));
|
||||
}
|
||||
|
||||
/** alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc
|
||||
/** alternate scorer advance(),advance(),next(),next(),advance(),advance(), etc
|
||||
* and ensure a hitcollector receives same docs and scores
|
||||
*/
|
||||
public static void checkSkipTo(final Query q, final IndexSearcher s) throws IOException {
|
||||
|
@ -319,7 +319,7 @@ public class QueryUtils {
|
|||
Scorer scorer = w.scorer(ctx, ctx.reader().getLiveDocs());
|
||||
if (scorer != null) {
|
||||
boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
}
|
||||
leafPtr++;
|
||||
}
|
||||
|
@ -341,7 +341,7 @@ public class QueryUtils {
|
|||
Scorer scorer = w.scorer(ctx, ctx.reader().getLiveDocs());
|
||||
if (scorer != null) {
|
||||
boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -370,11 +370,11 @@ public class QueryUtils {
|
|||
for (int i=lastDoc[0]+1; i<=doc; i++) {
|
||||
Weight w = s.createNormalizedWeight(q, true);
|
||||
Scorer scorer = w.scorer(context.get(leafPtr), liveDocs);
|
||||
Assert.assertTrue("query collected "+doc+" but skipTo("+i+") says no more docs!",scorer.advance(i) != DocIdSetIterator.NO_MORE_DOCS);
|
||||
Assert.assertEquals("query collected "+doc+" but skipTo("+i+") got to "+scorer.docID(),doc,scorer.docID());
|
||||
float skipToScore = scorer.score();
|
||||
Assert.assertEquals("unstable skipTo("+i+") score!",skipToScore,scorer.score(),maxDiff);
|
||||
Assert.assertEquals("query assigned doc "+doc+" a score of <"+score+"> but skipTo("+i+") has <"+skipToScore+">!",score,skipToScore,maxDiff);
|
||||
Assert.assertTrue("query collected "+doc+" but advance("+i+") says no more docs!",scorer.advance(i) != DocIdSetIterator.NO_MORE_DOCS);
|
||||
Assert.assertEquals("query collected "+doc+" but advance("+i+") got to "+scorer.docID(),doc,scorer.docID());
|
||||
float advanceScore = scorer.score();
|
||||
Assert.assertEquals("unstable advance("+i+") score!",advanceScore,scorer.score(),maxDiff);
|
||||
Assert.assertEquals("query assigned doc "+doc+" a score of <"+score+"> but advance("+i+") has <"+advanceScore+">!",score,advanceScore,maxDiff);
|
||||
|
||||
// Hurry things along if they are going slow (eg
|
||||
// if you got SimpleText codec this will kick in):
|
||||
|
@ -405,7 +405,7 @@ public class QueryUtils {
|
|||
Scorer scorer = w.scorer((LeafReaderContext)indexSearcher.getTopReaderContext(), previousReader.getLiveDocs());
|
||||
if (scorer != null) {
|
||||
boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
}
|
||||
leafPtr++;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public class QueryUtils {
|
|||
Scorer scorer = w.scorer((LeafReaderContext)indexSearcher.getTopReaderContext(), previousReader.getLiveDocs());
|
||||
if (scorer != null) {
|
||||
boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but advance("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue