mirror of https://github.com/apache/lucene.git
LUCENE-6753: defend against MockRandomMergePolicy
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1696808 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0718e99f36
commit
cd4e5dc2fc
|
@ -26,6 +26,7 @@ import org.apache.lucene.document.FieldType;
|
|||
import org.apache.lucene.document.TextField;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.index.RandomIndexWriter;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BooleanClause;
|
||||
|
@ -165,7 +166,9 @@ public class TestSimilarity2 extends LuceneTestCase {
|
|||
/** make sure scores are not skewed by docs not containing the field */
|
||||
public void testNoFieldSkew() throws Exception {
|
||||
Directory dir = newDirectory();
|
||||
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
|
||||
// an evil merge policy could reorder our docs for no reason
|
||||
IndexWriterConfig iwConfig = newIndexWriterConfig().setMergePolicy(newLogMergePolicy());
|
||||
RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwConfig);
|
||||
Document doc = new Document();
|
||||
doc.add(newTextField("foo", "bar baz somethingelse", Field.Store.NO));
|
||||
iw.addDocument(doc);
|
||||
|
|
Loading…
Reference in New Issue