Don't illegally reuse scorer in this test

Closes elastic/elasticsearch#3216

Original commit: elastic/x-pack-elasticsearch@63654c5585
This commit is contained in:
Mike McCandless 2016-08-25 11:42:48 -04:00
parent 6d361d0097
commit ab074da873
1 changed files with 4 additions and 5 deletions

View File

@ -351,7 +351,6 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
Weight weight = searcher.createNormalizedWeight(new TermQuery(new Term("field2", "value1")), false);
LeafReaderContext leaf = directoryReader.leaves().get(0);
Scorer scorer = weight.scorer(leaf);
SparseFixedBitSet sparseFixedBitSet = query(leaf, "field1", "value1");
LeafCollector leafCollector = new LeafBucketCollector() {
@ -360,7 +359,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
assertThat(doc, equalTo(0));
}
};
intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
sparseFixedBitSet = query(leaf, "field1", "value2");
leafCollector = new LeafBucketCollector() {
@ -369,7 +368,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
assertThat(doc, equalTo(1));
}
};
intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
sparseFixedBitSet = query(leaf, "field1", "value3");
@ -379,7 +378,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
fail("docId [" + doc + "] should have been deleted");
}
};
intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
sparseFixedBitSet = query(leaf, "field1", "value4");
leafCollector = new LeafBucketCollector() {
@ -388,7 +387,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
assertThat(doc, equalTo(3));
}
};
intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs());
directoryReader.close();
directory.close();