Skip to content

Apache Lucene open-source search software

add docvalues to testThreadInterruptDeadlock

Robert Muir2eee425da27e
diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
index 692eaaa7a7e..a04f8dd4d31 100644
--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
@@ -34,9 +34,12 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.simpletext.SimpleTextCodec;
+import org.apache.lucene.document.BinaryDocValuesField;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.LongDocValuesField;
+import org.apache.lucene.document.SortedBytesDocValuesField;
import org.apache.lucene.document.StoredField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
@@ -1017,10 +1020,16 @@ public class TestIndexWriter extends LuceneTestCase {
Document doc = new Document();
doc.add(newStringField(random, "id", "500", Field.Store.NO));
doc.add(newField(random, "field", "some prepackaged text contents", storedTextType));
+ doc.add(new BinaryDocValuesField("binarydv", new BytesRef("500")));
+ doc.add(new LongDocValuesField("numericdv", 500));
+ doc.add(new SortedBytesDocValuesField("sorteddv", new BytesRef("500")));
w.addDocument(doc);
doc = new Document();
doc.add(newStringField(random, "id", "501", Field.Store.NO));
doc.add(newField(random, "field", "some more contents", storedTextType));
+ doc.add(new BinaryDocValuesField("binarydv", new BytesRef("501")));
+ doc.add(new LongDocValuesField("numericdv", 501));
+ doc.add(new SortedBytesDocValuesField("sorteddv", new BytesRef("501")));
w.addDocument(doc);
w.deleteDocuments(new Term("id", "500"));
w.close();
@@ -1045,10 +1054,19 @@ public class TestIndexWriter extends LuceneTestCase {
Document doc = new Document();
Field idField = newStringField(random, "id", "", Field.Store.NO);
+ Field binaryDVField = new BinaryDocValuesField("binarydv", new BytesRef());
+ Field numericDVField = new LongDocValuesField("numericdv", 0);
+ Field sortedDVField = new SortedBytesDocValuesField("sorteddv", new BytesRef());
doc.add(idField);
doc.add(newField(random, "field", "some text contents", storedTextType));
+ doc.add(binaryDVField);
+ doc.add(numericDVField);
+ doc.add(sortedDVField);
for(int i=0;i<100;i++) {
idField.setStringValue(Integer.toString(i));
+ binaryDVField.setBytesValue(new BytesRef(idField.stringValue()));
+ numericDVField.setLongValue(i);
+ sortedDVField.setBytesValue(new BytesRef(idField.stringValue()));
int action = random.nextInt(100);
if (action == 17) {
w.addIndexes(adder);
@@ -1149,7 +1167,6 @@ public class TestIndexWriter extends LuceneTestCase {
}
}
- //nocommit: make this tests DV2.0
public void testThreadInterruptDeadlock() throws Exception {
IndexerThreadInterrupt t = new IndexerThreadInterrupt();
t.setDaemon(true);