mirror of https://github.com/apache/lucene.git
LUCENE-6766: add deletions to random test
This commit is contained in:
parent
3010ffacaf
commit
a4722befb3
|
@ -1214,6 +1214,10 @@ public class TestIndexSorting extends LuceneTestCase {
|
||||||
iwc2.setIndexSort(sort);
|
iwc2.setIndexSort(sort);
|
||||||
IndexWriter w2 = new IndexWriter(dir2, iwc2);
|
IndexWriter w2 = new IndexWriter(dir2, iwc2);
|
||||||
|
|
||||||
|
Set<Integer> toDelete = new HashSet<>();
|
||||||
|
|
||||||
|
double deleteChance = random().nextDouble();
|
||||||
|
|
||||||
for(int id=0;id<numDocs;id++) {
|
for(int id=0;id<numDocs;id++) {
|
||||||
RandomDoc docValues = new RandomDoc(id);
|
RandomDoc docValues = new RandomDoc(id);
|
||||||
docs.add(docValues);
|
docs.add(docValues);
|
||||||
|
@ -1236,7 +1240,13 @@ public class TestIndexSorting extends LuceneTestCase {
|
||||||
doc.add(new SortedDocValuesField("bytes", new BytesRef(docValues.bytesValue)));
|
doc.add(new SortedDocValuesField("bytes", new BytesRef(docValues.bytesValue)));
|
||||||
w1.addDocument(doc);
|
w1.addDocument(doc);
|
||||||
w2.addDocument(doc);
|
w2.addDocument(doc);
|
||||||
// nocommit do some deletions
|
if (random().nextDouble() < deleteChance) {
|
||||||
|
toDelete.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int id : toDelete) {
|
||||||
|
w1.deleteDocuments(new Term("id", Integer.toString(id)));
|
||||||
|
w2.deleteDocuments(new Term("id", Integer.toString(id)));
|
||||||
}
|
}
|
||||||
DirectoryReader r1 = DirectoryReader.open(w1);
|
DirectoryReader r1 = DirectoryReader.open(w1);
|
||||||
IndexSearcher s1 = newSearcher(r1);
|
IndexSearcher s1 = newSearcher(r1);
|
||||||
|
|
Loading…
Reference in New Issue