fix buggy 'advance called before nextDoc' case

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1663186 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2015-03-02 00:32:27 +00:00
parent a9915c6616
commit 959dfcb7de
2 changed files with 9 additions and 0 deletions

View File

@ -149,6 +149,12 @@ class TermAutomatonScorer extends Scorer {
@Override
public int advance(int target) throws IOException {
if (docID == -1) {
popCurrentDoc();
if (docID >= target) {
return doNext();
}
}
for(int i=0;i<numSubsOnDoc;i++) {
EnumAndScorer sub = subsOnDoc[i];
if (sub.posEnum.advance(target) != NO_MORE_DOCS) {

View File

@ -578,6 +578,9 @@ public class TestTermAutomatonQuery extends LuceneTestCase {
Query q1 = q;
Query q2 = bq;
if (random().nextInt(5) == 1) {
if (VERBOSE) {
System.out.println(" use random filter");
}
RandomFilter filter = new RandomFilter(random().nextLong(), random().nextFloat());
q1 = new FilteredQuery(q1, filter);
q2 = new FilteredQuery(q2, filter);