LUCENE-2308: final cleanup before landing
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/fieldtype_conflicted@1161533 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java b/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java
index 1ace1ce..9234edc 100644
--- a/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java
+++ b/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java
@@ -176,8 +176,6 @@
// field that is indexed (i.e. searchable), but don't tokenize
// the field into separate words and don't index term frequency
// or positional information:
- FieldType ft = new FieldType(TextField.TYPE_STORED);
- ft.setIndexOptions(IndexOptions.DOCS_ONLY);
Field pathField = new Field("path", StringField.TYPE_STORED, file.getPath());
doc.add(pathField);
diff --git a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
index fc2d326..0e76d0d 100644
--- a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
+++ b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
@@ -230,8 +230,7 @@
try {
final Document document = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectorOffsets(true);
customType.setStoreTermVectors(true);
document.add(new Field(FIELD, customType, TEXT));
diff --git a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
index a5c2975..92901c2 100644
--- a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
+++ b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java
@@ -1637,9 +1637,7 @@
private Document doc( String f, String v ){
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add( new Field( f, customType, v));
+ doc.add( new Field( f, TextField.TYPE_STORED, v));
return doc;
}
@@ -1754,23 +1752,21 @@
addDoc(writer, text);
}
Document doc = new Document();
- FieldType storedNumericType = new FieldType(NumericField.TYPE_UNSTORED);
- storedNumericType.setStored(true);
- NumericField nfield = new NumericField(NUMERIC_FIELD_NAME, storedNumericType);
+ NumericField nfield = new NumericField(NUMERIC_FIELD_NAME, NumericField.TYPE_STORED);
nfield.setIntValue(1);
doc.add(nfield);
writer.addDocument(doc, analyzer);
- nfield = new NumericField(NUMERIC_FIELD_NAME, storedNumericType);
+ nfield = new NumericField(NUMERIC_FIELD_NAME, NumericField.TYPE_STORED);
nfield.setIntValue(3);
doc = new Document();
doc.add(nfield);
writer.addDocument(doc, analyzer);
- nfield = new NumericField(NUMERIC_FIELD_NAME, storedNumericType);
+ nfield = new NumericField(NUMERIC_FIELD_NAME, NumericField.TYPE_STORED);
nfield.setIntValue(5);
doc = new Document();
doc.add(nfield);
writer.addDocument(doc, analyzer);
- nfield = new NumericField(NUMERIC_FIELD_NAME, storedNumericType);
+ nfield = new NumericField(NUMERIC_FIELD_NAME, NumericField.TYPE_STORED);
nfield.setIntValue(7);
doc = new Document();
doc.add(nfield);
@@ -1792,9 +1788,7 @@
private void addDoc(IndexWriter writer, String text) throws IOException {
Document d = new Document();
- FieldType storedType = new FieldType(TextField.TYPE_UNSTORED);
- storedType.setStored(true);
- Field f = new Field(FIELD_NAME, storedType, text);
+ Field f = new Field(FIELD_NAME, TextField.TYPE_STORED, text);
d.add(f);
writer.addDocument(d);
diff --git a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java
index f874b4a..cf513ca 100644
--- a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java
+++ b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java
@@ -359,11 +359,10 @@
IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig(
TEST_VERSION_CURRENT, analyzer).setOpenMode(OpenMode.CREATE));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorOffsets(true);
customType.setStoreTermVectorPositions(true);
- customType.setStored(true);
for( String value: values ) {
doc.add( new Field( F, customType, value ) );
}
diff --git a/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java b/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
index dbfddf1..004b8fb 100644
--- a/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
+++ b/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java
@@ -206,8 +206,7 @@
private void assembleDocument(Document document, int i) {
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorOffsets(true);
customType.setStoreTermVectorPositions(true);
@@ -218,8 +217,7 @@
document.add(new Field("b0", customType, i + " All work and no play makes Jack a dull boy"));
//document.add(new Field("b1", i + " All work and no play makes Jack a dull boy", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO));
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setTokenized(false);
customType2.setOmitNorms(true);
document.add(new Field("b1", customType2, i + " All work and no play makes Jack a dull boy"));
@@ -230,8 +228,7 @@
document.add(new Field("b1", customType3, i + " All work and no play makes Jack a dull boy"));
//document.add(new Field("b3", i + " All work and no play makes Jack a dull boy", Field.Store.YES, Field.Index.NO, Field.TermVector.NO));
- FieldType customType4 = new FieldType(TextField.TYPE_UNSTORED);
- customType4.setStored(true);
+ FieldType customType4 = new FieldType(TextField.TYPE_STORED);
customType4.setIndexed(false);
customType4.setTokenized(false);
document.add(new Field("b1", customType4, i + " All work and no play makes Jack a dull boy"));
diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java b/lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java
index 48f5cf3..2cd5bf3 100644
--- a/lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java
+++ b/lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java
@@ -322,4 +322,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java
index 09c257e..62207fa 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java
@@ -316,4 +316,4 @@
assertEquals((byte) (size>>> 8), sizebytes[2]);
assertEquals((byte) size , sizebytes[3]);
}
-}
\ No newline at end of file
+}
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java
index 698a9f3..d2a741d 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java
@@ -30,6 +30,7 @@
import org.apache.lucene.document.FieldSelectorVisitor;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.SetBasedFieldSelector;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
@@ -52,17 +53,10 @@
static void addDocumentWithFields(IndexWriter writer) throws IOException {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
-
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
-
FieldType customType3 = new FieldType();
customType3.setStored(true);
- doc.add(newField("keyword", "test1", customType));
- doc.add(newField("text", "test1", customType2));
+ doc.add(newField("keyword", "test1", StringField.TYPE_STORED));
+ doc.add(newField("text", "test1", TextField.TYPE_STORED));
doc.add(newField("unindexed", "test1", customType3));
doc.add(new TextField("unstored","test1"));
writer.addDocument(doc);
@@ -72,17 +66,10 @@
static void addDocumentWithDifferentFields(IndexWriter writer) throws IOException {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
-
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
-
FieldType customType3 = new FieldType();
customType3.setStored(true);
- doc.add(newField("keyword2", "test1", customType));
- doc.add(newField("text2", "test1", customType2));
+ doc.add(newField("keyword2", "test1", StringField.TYPE_STORED));
+ doc.add(newField("text2", "test1", TextField.TYPE_STORED));
doc.add(newField("unindexed2", "test1", customType3));
doc.add(new TextField("unstored2","test1"));
writer.addDocument(doc);
@@ -90,25 +77,19 @@
static void addDocumentWithTermVectorFields(IndexWriter writer) throws IOException {
Document doc = new Document();
- FieldType customType4 = new FieldType(TextField.TYPE_UNSTORED);
- customType4.setStored(true);
- FieldType customType5 = new FieldType(TextField.TYPE_UNSTORED);
- customType5.setStored(true);
+ FieldType customType5 = new FieldType(TextField.TYPE_STORED);
customType5.setStoreTermVectors(true);
- FieldType customType6 = new FieldType(TextField.TYPE_UNSTORED);
- customType6.setStored(true);
+ FieldType customType6 = new FieldType(TextField.TYPE_STORED);
customType6.setStoreTermVectors(true);
customType6.setStoreTermVectorOffsets(true);
- FieldType customType7 = new FieldType(TextField.TYPE_UNSTORED);
- customType7.setStored(true);
+ FieldType customType7 = new FieldType(TextField.TYPE_STORED);
customType7.setStoreTermVectors(true);
customType7.setStoreTermVectorPositions(true);
- FieldType customType8 = new FieldType(TextField.TYPE_UNSTORED);
- customType8.setStored(true);
+ FieldType customType8 = new FieldType(TextField.TYPE_STORED);
customType8.setStoreTermVectors(true);
customType8.setStoreTermVectorOffsets(true);
customType8.setStoreTermVectorPositions(true);
- doc.add(newField("tvnot","tvnot",customType4));
+ doc.add(newField("tvnot","tvnot",TextField.TYPE_STORED));
doc.add(newField("termvector","termvector",customType5));
doc.add(newField("tvoffset","tvoffset", customType6));
doc.add(newField("tvposition","tvposition", customType7));
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribParallelReader.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribParallelReader.java
index e463109..6e85a67 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribParallelReader.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribParallelReader.java
@@ -62,18 +62,16 @@
dir = newDirectory();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d1 = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d1.add(newField("f1", "v1", customType));
- d1.add(newField("f2", "v1", customType));
- d1.add(newField("f3", "v1", customType));
- d1.add(newField("f4", "v1", customType));
+ d1.add(newField("f1", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f2", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f3", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f4", "v1", TextField.TYPE_STORED));
w.addDocument(d1);
Document d2 = new Document();
- d2.add(newField("f1", "v2", customType));
- d2.add(newField("f2", "v2", customType));
- d2.add(newField("f3", "v2", customType));
- d2.add(newField("f4", "v2", customType));
+ d2.add(newField("f1", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f2", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f3", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f4", "v2", TextField.TYPE_STORED));
w.addDocument(d2);
w.close();
@@ -124,14 +122,12 @@
Directory dir1 = newDirectory();
IndexWriter w1 = new IndexWriter(dir1, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d1 = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d1.add(newField("f1", "v1", customType));
- d1.add(newField("f2", "v1", customType));
+ d1.add(newField("f1", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f2", "v1", TextField.TYPE_STORED));
w1.addDocument(d1);
Document d2 = new Document();
- d2.add(newField("f1", "v2", customType));
- d2.add(newField("f2", "v2", customType));
+ d2.add(newField("f1", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f2", "v2", TextField.TYPE_STORED));
w1.addDocument(d2);
w1.close();
return dir1;
@@ -139,16 +135,14 @@
private Directory getDir2(Random random) throws IOException {
Directory dir2 = newDirectory();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
IndexWriter w2 = new IndexWriter(dir2, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d3 = new Document();
- d3.add(newField("f3", "v1", customType));
- d3.add(newField("f4", "v1", customType));
+ d3.add(newField("f3", "v1", TextField.TYPE_STORED));
+ d3.add(newField("f4", "v1", TextField.TYPE_STORED));
w2.addDocument(d3);
Document d4 = new Document();
- d4.add(newField("f3", "v2", customType));
- d4.add(newField("f4", "v2", customType));
+ d4.add(newField("f3", "v2", TextField.TYPE_STORED));
+ d4.add(newField("f4", "v2", TextField.TYPE_STORED));
w2.addDocument(d4);
w2.close();
return dir2;
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
index 83dac90..17faa51 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
@@ -24,6 +24,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.search.Collector;
@@ -68,20 +69,14 @@
for (int i = 0; i < NUM_DOCS; i++) {
Document d = new Document();
- FieldType storedTextType = new FieldType(TextField.TYPE_UNSTORED);
- storedTextType.setStored(true);
- d.add(newField("field", "word", storedTextType));
+ d.add(newField("field", "word", TextField.TYPE_STORED));
- FieldType storedTextType2 = new FieldType(TextField.TYPE_UNSTORED);
- storedTextType2.setStored(true);
- storedTextType2.setTokenized(false);
- storedTextType2.setOmitNorms(true);
- d.add(newField("nonorm", "word", storedTextType2));
- d.add(newField("untokfield", "20061212 20071212", storedTextType));
+ d.add(newField("nonorm", "word", StringField.TYPE_STORED));
+ d.add(newField("untokfield", "20061212 20071212", TextField.TYPE_STORED));
for (int j = 1; j <= i; j++) {
- d.add(newField("field", "crap", storedTextType));
- d.add(newField("nonorm", "more words", storedTextType2));
+ d.add(newField("field", "crap", TextField.TYPE_STORED));
+ d.add(newField("nonorm", "more words", StringField.TYPE_STORED));
}
writer.addDocument(d);
}
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java
index b7f55df..043655c 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java
@@ -20,10 +20,11 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.LuceneTestCase;
public class TestMultiPassIndexSplitter extends LuceneTestCase {
IndexReader input;
@@ -38,13 +39,8 @@
Document doc;
for (int i = 0; i < NUM_DOCS; i++) {
doc = new Document();
- FieldType storedTextType = new FieldType(TextField.TYPE_UNSTORED);
- storedTextType.setStored(true);
- storedTextType.setTokenized(false);
- FieldType storedTextType2 = new FieldType(TextField.TYPE_UNSTORED);
- storedTextType.setStored(true);
- doc.add(newField("id", i + "", storedTextType));
- doc.add(newField("f", i + " " + i, storedTextType2));
+ doc.add(newField("id", i + "", StringField.TYPE_STORED));
+ doc.add(newField("f", i + " " + i, TextField.TYPE_STORED));
w.addDocument(doc);
}
w.close();
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java
index d2f31d7..4c6c72f 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java
@@ -140,8 +140,7 @@
((TieredMergePolicy)cfg.getMergePolicy()).setUseCompoundFile(false);
IndexWriter writer = new IndexWriter(dir, cfg);
Document doc = new Document();
- FieldType storedTextType = new FieldType(TextField.TYPE_UNSTORED);
- storedTextType.setStored(true);
+ FieldType storedTextType = new FieldType(TextField.TYPE_STORED);
storedTextType.setStoreTermVectors(true);
storedTextType.setStoreTermVectorPositions(true);
storedTextType.setStoreTermVectorOffsets(true);
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestHighFreqTerms.java b/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestHighFreqTerms.java
index 8f104cd..26016c7 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestHighFreqTerms.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestHighFreqTerms.java
@@ -201,15 +201,13 @@
/**
* Generate 10 documents where term n has a docFreq of n and a totalTermFreq of n*2 (squared).
*/
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 1; i <= 10; i++) {
Document doc = new Document();
String content = getContent(i);
- doc.add(newField(random, "FIELD_1", content, customType));
+ doc.add(newField(random, "FIELD_1", content, TextField.TYPE_STORED));
//add a different field
- doc.add(newField(random, "different_field", "diff", customType));
+ doc.add(newField(random, "different_field", "diff", TextField.TYPE_STORED));
writer.addDocument(doc);
}
@@ -217,7 +215,7 @@
//highest freq terms for a specific field.
for (int i = 1; i <= 10; i++) {
Document doc = new Document();
- doc.add(newField(random, "different_field", "diff", customType));
+ doc.add(newField(random, "different_field", "diff", TextField.TYPE_STORED));
writer.addDocument(doc);
}
// add some docs where tf < df so we can see if sorting works
@@ -228,7 +226,7 @@
for (int i = 0; i < highTF; i++) {
content += "highTF ";
}
- doc.add(newField(random, "FIELD_1", content, customType));
+ doc.add(newField(random, "FIELD_1", content, TextField.TYPE_STORED));
writer.addDocument(doc);
// highTF medium df =5
int medium_df = 5;
@@ -239,7 +237,7 @@
for (int j = 0; j < tf; j++) {
newcontent += "highTFmedDF ";
}
- newdoc.add(newField(random, "FIELD_1", newcontent, customType));
+ newdoc.add(newField(random, "FIELD_1", newcontent, TextField.TYPE_STORED));
writer.addDocument(newdoc);
}
// add a doc with high tf in field different_field
@@ -249,7 +247,7 @@
for (int i = 0; i < targetTF; i++) {
content += "TF150 ";
}
- doc.add(newField(random, "different_field", content, customType));
+ doc.add(newField(random, "different_field", content, TextField.TYPE_STORED));
writer.addDocument(doc);
writer.close();
diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java b/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
index 0f34470..ca9ad41 100644
--- a/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
+++ b/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
@@ -23,11 +23,12 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.FieldNormModifier;
-import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.MultiNorms;
import org.apache.lucene.index.Term;
@@ -72,17 +73,12 @@
for (int i = 0; i < NUM_DOCS; i++) {
Document d = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d.add(newField("field", "word", customType));
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
- customType2.setOmitNorms(true);
- d.add(newField("nonorm", "word", customType2));
+ d.add(newField("field", "word", TextField.TYPE_STORED));
+ d.add(newField("nonorm", "word", StringField.TYPE_STORED));
for (int j = 1; j <= i; j++) {
- d.add(newField("field", "crap", customType));
- d.add(newField("nonorm", "more words", customType2));
+ d.add(newField("field", "crap", TextField.TYPE_STORED));
+ d.add(newField("nonorm", "more words", StringField.TYPE_STORED));
}
writer.addDocument(d);
}
diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
index a7ad505..46e07fb 100644
--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
@@ -22,6 +22,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -30,10 +31,10 @@
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.CachingWrapperFilter;
import org.apache.lucene.search.Filter;
+import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.QueryWrapperFilter;
-import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TermRangeFilter;
import org.apache.lucene.search.TopDocs;
@@ -63,12 +64,9 @@
for (int i = 0; i < MAX; i++) {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- doc.add(newField("key", "" + (i + 1), customType));
- doc.add(newField("owner", (i < MAX / 2) ? "bob" : "sue", customType));
- doc.add(newField("date", cal.getTime().toString(), customType));
+ doc.add(newField("key", "" + (i + 1), StringField.TYPE_STORED));
+ doc.add(newField("owner", (i < MAX / 2) ? "bob" : "sue", StringField.TYPE_STORED));
+ doc.add(newField("date", cal.getTime().toString(), StringField.TYPE_STORED));
writer.addDocument(doc);
cal.add(Calendar.DATE, 1);
diff --git a/lucene/contrib/queries/src/test/org/apache/lucene/search/TestSlowCollationMethods.java b/lucene/contrib/queries/src/test/org/apache/lucene/search/TestSlowCollationMethods.java
index 441a3aa..a3474e0 100644
--- a/lucene/contrib/queries/src/test/org/apache/lucene/search/TestSlowCollationMethods.java
+++ b/lucene/contrib/queries/src/test/org/apache/lucene/search/TestSlowCollationMethods.java
@@ -7,6 +7,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -58,11 +59,7 @@
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
String value = _TestUtil.randomUnicodeString(random);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setOmitNorms(true);
- customType.setTokenized(false);
- Field field = newField("field", value, customType);
+ Field field = newField("field", value, StringField.TYPE_STORED);
doc.add(field);
iw.addDocument(doc);
}
diff --git a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
index be022e7..2f9754e 100644
--- a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
+++ b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
@@ -26,9 +26,10 @@
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
@@ -96,29 +97,21 @@
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("name", name, customType));
+ doc.add(newField("name", name, TextField.TYPE_STORED));
// convert the lat / long to lucene fields
- FieldType customType2 = new FieldType(NumericField.TYPE_UNSTORED);
- customType2.setStored(true);
- doc.add(new NumericField(latField, Integer.MAX_VALUE, customType2).setDoubleValue(lat));
- doc.add(new NumericField(lngField, Integer.MAX_VALUE, customType2).setDoubleValue(lng));
+ doc.add(new NumericField(latField, Integer.MAX_VALUE, NumericField.TYPE_STORED).setDoubleValue(lat));
+ doc.add(new NumericField(lngField, Integer.MAX_VALUE, NumericField.TYPE_STORED).setDoubleValue(lng));
// add a default meta field to make searching all documents easy
- doc.add(newField("metafile", "doc", customType));
+ doc.add(newField("metafile", "doc", TextField.TYPE_STORED));
int ctpsize = ctps.size();
- FieldType customType3 = new FieldType(TextField.TYPE_UNSTORED);
- customType3.setStored(true);
- customType3.setTokenized(false);
- customType3.setOmitNorms(true);
for (int i =0; i < ctpsize; i++){
CartesianTierPlotter ctp = ctps.get(i);
- doc.add(new NumericField(ctp.getTierFieldName(), Integer.MAX_VALUE, customType).setDoubleValue(ctp.getTierBoxId(lat,lng)));
+ doc.add(new NumericField(ctp.getTierFieldName(), Integer.MAX_VALUE, TextField.TYPE_STORED).setDoubleValue(ctp.getTierBoxId(lat,lng)));
- doc.add(newField(geoHashPrefix, GeoHashUtils.encode(lat,lng), customType3));
+ doc.add(newField(geoHashPrefix, GeoHashUtils.encode(lat,lng), StringField.TYPE_STORED));
}
writer.addDocument(doc);
diff --git a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
index 630531c..cf12fdd 100644
--- a/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
+++ b/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
@@ -65,18 +65,14 @@
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("name", name, customType));
+ doc.add(newField("name", name, TextField.TYPE_STORED));
// convert the lat / long to lucene fields
- FieldType customType2 = new FieldType(NumericField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(new NumericField(latField, Integer.MAX_VALUE, customType2).setDoubleValue(lat));
- doc.add(new NumericField(lngField, Integer.MAX_VALUE, customType2).setDoubleValue(lng));
+ doc.add(new NumericField(latField, Integer.MAX_VALUE, NumericField.TYPE_STORED).setDoubleValue(lat));
+ doc.add(new NumericField(lngField, Integer.MAX_VALUE, NumericField.TYPE_STORED).setDoubleValue(lng));
// add a default meta field to make searching all documents easy
- doc.add(newField("metafile", "doc", customType));
+ doc.add(newField("metafile", "doc", TextField.TYPE_STORED));
writer.addDocument(doc);
}
diff --git a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
index c8fcad3..84ff006 100644
--- a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
+++ b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
@@ -59,16 +59,14 @@
dir=newDirectory();
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(Version.LUCENE_40, analyzer));
String line = d.readLine();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
while(line!=null)
{
int endOfDate=line.indexOf('\t');
String date=line.substring(0,endOfDate).trim();
String content=line.substring(endOfDate).trim();
Document doc = new Document();
- doc.add(newField("date",date,customType));
- doc.add(newField("contents",content,customType));
+ doc.add(newField("date",date,TextField.TYPE_STORED));
+ doc.add(newField("contents",content,TextField.TYPE_STORED));
NumericField numericField = new NumericField("date2");
numericField.setIntValue(Integer.valueOf(date));
doc.add(numericField);
diff --git a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java
index 6140dd6..58f618d 100644
--- a/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java
+++ b/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestQueryTemplateManager.java
@@ -1,5 +1,22 @@
package org.apache.lucene.xmlparser;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import java.io.IOException;
import java.util.Locale;
import java.util.Properties;
@@ -24,22 +41,6 @@
import org.xml.sax.SAXException;
/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
* This class illustrates how form input (such as from a web page or Swing gui) can be
* turned into Lucene queries using a choice of XSL templates for different styles of queries.
*/
@@ -130,15 +131,13 @@
{
org.apache.lucene.document.Document result=new org.apache.lucene.document.Document();
StringTokenizer st=new StringTokenizer(nameValuePairs,"\t=");
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
while(st.hasMoreTokens())
{
String name=st.nextToken().trim();
if(st.hasMoreTokens())
{
String value=st.nextToken().trim();
- result.add(newField(name,value,customType));
+ result.add(newField(name,value,TextField.TYPE_STORED));
}
}
return result;
diff --git a/lucene/src/java/org/apache/lucene/document/BinaryField.java b/lucene/src/java/org/apache/lucene/document/BinaryField.java
index f6218d5..0776afd 100644
--- a/lucene/src/java/org/apache/lucene/document/BinaryField.java
+++ b/lucene/src/java/org/apache/lucene/document/BinaryField.java
@@ -36,7 +36,7 @@
}
public BinaryField(String name, BytesRef bytes) {
- super(name, BinaryField.TYPE_STORED, bytes.bytes, bytes.offset, bytes.length);
+ super(name, BinaryField.TYPE_STORED, bytes);
}
public BinaryField(String name, FieldType custom, byte[] value) {
diff --git a/lucene/src/java/org/apache/lucene/document/Document.java b/lucene/src/java/org/apache/lucene/document/Document.java
index 77d471c..6282788 100644
--- a/lucene/src/java/org/apache/lucene/document/Document.java
+++ b/lucene/src/java/org/apache/lucene/document/Document.java
@@ -214,7 +214,7 @@
* method returns the first value added. If only binary fields with this name
* exist, returns null.
* For {@link NumericField} it returns the string value of the number. If you want
- * the actual {@code NumericField} instance back, use {@link #getFieldable}.
+ * the actual {@code NumericField} instance back, use {@link #getField}.
*/
public final String get(String name) {
for (IndexableField field : fields) {
diff --git a/lucene/src/java/org/apache/lucene/search/FieldCache.java b/lucene/src/java/org/apache/lucene/search/FieldCache.java
index 3a81ddd..e286a34 100644
--- a/lucene/src/java/org/apache/lucene/search/FieldCache.java
+++ b/lucene/src/java/org/apache/lucene/search/FieldCache.java
@@ -24,7 +24,7 @@
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.NumericField; // for javadocs
import org.apache.lucene.analysis.NumericTokenStream; // for javadocs
import org.apache.lucene.util.packed.PackedInts;
diff --git a/lucene/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java b/lucene/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java
index c231989..e14ded8 100644
--- a/lucene/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java
+++ b/lucene/src/java/org/apache/lucene/search/FieldCacheRangeFilter.java
@@ -23,7 +23,7 @@
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
-import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.NumericField; // for javadocs
/**
* A range filter built on top of a cached single term field (in {@link FieldCache}).
diff --git a/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java b/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java
index 891e928..116972a 100644
--- a/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java
+++ b/lucene/src/java/org/apache/lucene/search/NumericRangeFilter.java
@@ -18,7 +18,7 @@
*/
import org.apache.lucene.analysis.NumericTokenStream; // for javadocs
-import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.NumericField; // for javadocs
import org.apache.lucene.util.NumericUtils; // for javadocs
/**
diff --git a/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java b/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java
index fcb5155..1d0b662 100644
--- a/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java
+++ b/lucene/src/java/org/apache/lucene/search/NumericRangeQuery.java
@@ -22,7 +22,7 @@
import java.util.Comparator;
import org.apache.lucene.analysis.NumericTokenStream; // for javadocs
-import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.NumericField; // for javadocs
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.ToStringUtils;
import org.apache.lucene.index.Terms;
diff --git a/lucene/src/java/org/apache/lucene/search/Similarity.java b/lucene/src/java/org/apache/lucene/search/Similarity.java
index d58f3d2..fe184be 100644
--- a/lucene/src/java/org/apache/lucene/search/Similarity.java
+++ b/lucene/src/java/org/apache/lucene/search/Similarity.java
@@ -221,4 +221,4 @@
*/
public abstract void normalize(float queryNorm, float topLevelBoost);
}
-}
\ No newline at end of file
+}
diff --git a/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java b/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java
index 0a1a92e..d65e3b0 100644
--- a/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java
+++ b/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java
@@ -29,6 +29,7 @@
import org.apache.lucene.document.BinaryField;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
@@ -74,15 +75,11 @@
textField3 = new Field(TEXT_FIELD_3_KEY, customType3, FIELD_3_TEXT);
}
- public static final FieldType customType4;
public static final String KEYWORD_TEXT = "Keyword";
public static final String KEYWORD_FIELD_KEY = "keyField";
public static Field keyField;
static {
- customType4 = new FieldType(TextField.TYPE_UNSTORED);
- customType4.setStored(true);
- customType4.setTokenized(false);
- keyField = new Field(KEYWORD_FIELD_KEY, customType4, KEYWORD_TEXT);
+ keyField = new Field(KEYWORD_FIELD_KEY, StringField.TYPE_STORED, KEYWORD_TEXT);
}
public static final FieldType customType5;
@@ -90,9 +87,8 @@
public static final String NO_NORMS_KEY = "omitNorms";
public static Field noNormsField;
static {
- customType5 = new FieldType(TextField.TYPE_UNSTORED);
+ customType5 = new FieldType(TextField.TYPE_STORED);
customType5.setOmitNorms(true);
- customType5.setStored(true);
customType5.setTokenized(false);
noNormsField = new Field(NO_NORMS_KEY, customType5, NO_NORMS_TEXT);
}
@@ -102,9 +98,8 @@
public static final String NO_TF_KEY = "omitTermFreqAndPositions";
public static Field noTFField;
static {
- customType6 = new FieldType(TextField.TYPE_UNSTORED);
+ customType6 = new FieldType(TextField.TYPE_STORED);
customType6.setIndexOptions(IndexOptions.DOCS_ONLY);
- customType6.setStored(true);
noTFField = new Field(NO_TF_KEY, customType6, NO_TF_TEXT);
}
diff --git a/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java b/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
index b438bbb..afd21b8 100644
--- a/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
+++ b/lucene/src/test-framework/org/apache/lucene/util/LuceneTestCase.java
@@ -1111,7 +1111,7 @@
}
public static Field newField(Random random, String name, String value, FieldType type) {
- if (usually(random)) {
+ if (usually(random) || !type.indexed()) {
// most of the time, don't modify the params
return new Field(name, type, value);
}
@@ -1121,11 +1121,8 @@
newType.setStored(true); // randomly store it
}
- if (newType.indexed() && !newType.storeTermVectors()) {
- newType.setStoreTermVectors(random.nextBoolean());
- }
-
- if (!newType.storeTermVectors()) {
+ if (!newType.storeTermVectors() && random.nextBoolean()) {
+ newType.setStoreTermVectors(true);
if (!newType.storeTermVectorOffsets()) {
newType.setStoreTermVectorOffsets(random.nextBoolean());
}
diff --git a/lucene/src/test/org/apache/lucene/TestDemo.java b/lucene/src/test/org/apache/lucene/TestDemo.java
index 8f4d27a..e298b8e 100644
--- a/lucene/src/test/org/apache/lucene/TestDemo.java
+++ b/lucene/src/test/org/apache/lucene/TestDemo.java
@@ -50,9 +50,7 @@
Document doc = new Document();
String longTerm = "longtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongtermlongterm";
String text = "This is the text to be indexed. " + longTerm;
- FieldType textType = new FieldType(TextField.TYPE_UNSTORED);
- textType.setStored(true);
- doc.add(newField("fieldname", text, textType));
+ doc.add(newField("fieldname", text, TextField.TYPE_STORED));
iwriter.addDocument(doc);
iwriter.close();
diff --git a/lucene/src/test/org/apache/lucene/index/Test2BTerms.java b/lucene/src/test/org/apache/lucene/index/Test2BTerms.java
index 40a37db..344ad29 100644
--- a/lucene/src/test/org/apache/lucene/index/Test2BTerms.java
+++ b/lucene/src/test/org/apache/lucene/index/Test2BTerms.java
@@ -178,8 +178,7 @@
Document doc = new Document();
final MyTokenStream ts = new MyTokenStream(random, TERMS_PER_DOC);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setIndexOptions(IndexOptions.DOCS_ONLY);
customType.setOmitNorms(true);
Field field = new Field("field", customType, ts);
diff --git a/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java b/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
index bd7b17e..1f3d7e2 100755
--- a/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
+++ b/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
@@ -165,11 +165,9 @@
// Adds 10 docs, then replaces them with another 10
// docs, so 10 pending deletes:
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setTokenized(false);
for (int i = 0; i < 20; i++) {
Document doc = new Document();
- doc.add(newField("id", "" + (i % 10), customType));
+ doc.add(newField("id", "" + (i % 10), StringField.TYPE_UNSTORED));
doc.add(newField("content", "bbb " + i, TextField.TYPE_UNSTORED));
writer.updateDocument(new Term("id", "" + (i%10)), doc);
}
@@ -202,11 +200,9 @@
// Adds 10 docs, then replaces them with another 10
// docs, so 10 pending deletes:
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setTokenized(false);
for (int i = 0; i < 20; i++) {
Document doc = new Document();
- doc.add(newField("id", "" + (i % 10), customType));
+ doc.add(newField("id", "" + (i % 10), StringField.TYPE_UNSTORED));
doc.add(newField("content", "bbb " + i, TextField.TYPE_UNSTORED));
writer.updateDocument(new Term("id", "" + (i%10)), doc);
}
@@ -242,11 +238,9 @@
// Adds 10 docs, then replaces them with another 10
// docs, so 10 pending deletes:
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setTokenized(false);
for (int i = 0; i < 20; i++) {
Document doc = new Document();
- doc.add(newField("id", "" + (i % 10), customType));
+ doc.add(newField("id", "" + (i % 10), StringField.TYPE_UNSTORED));
doc.add(newField("content", "bbb " + i, TextField.TYPE_UNSTORED));
writer.updateDocument(new Term("id", "" + (i%10)), doc);
}
@@ -584,8 +578,7 @@
.setMaxBufferedDocs(5).setMergePolicy(lmp));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -977,10 +970,8 @@
private void addDocs3(IndexWriter writer, int numDocs) throws IOException {
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
doc.add(newField("content", "aaa", TextField.TYPE_UNSTORED));
- doc.add(newField("id", "" + i, customType));
+ doc.add(newField("id", "" + i, TextField.TYPE_STORED));
writer.addDocument(doc);
}
}
@@ -1067,8 +1058,7 @@
dirs[i] = new RAMDirectory();
IndexWriter w = new IndexWriter(dirs[i], new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
d.add(new Field("c", customType, "v"));
w.addDocument(d);
@@ -1108,9 +1098,7 @@
new MockAnalyzer(random)).setMergePolicy(lmp2);
IndexWriter w2 = new IndexWriter(src, conf2);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(new Field("c", customType, "some text"));
+ doc.add(new Field("c", TextField.TYPE_STORED, "some text"));
w2.addDocument(doc);
doc = new Document();
doc.add(new StringField("d", "delete"));
diff --git a/lucene/src/test/org/apache/lucene/index/TestAtomicUpdate.java b/lucene/src/test/org/apache/lucene/index/TestAtomicUpdate.java
index c017e1d..8d4bf43 100644
--- a/lucene/src/test/org/apache/lucene/index/TestAtomicUpdate.java
+++ b/lucene/src/test/org/apache/lucene/index/TestAtomicUpdate.java
@@ -93,11 +93,9 @@
@Override
public void doWork() throws Exception {
// Update all 100 docs...
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
for(int i=0; i<100; i++) {
Document d = new Document();
- d.add(new Field("id", customType, Integer.toString(i)));
+ d.add(new Field("id", StringField.TYPE_STORED, Integer.toString(i)));
d.add(new TextField("contents", English.intToEnglish(i+10*count)));
writer.updateDocument(new Term("id", Integer.toString(i)), d);
}
@@ -136,11 +134,9 @@
writer.setInfoStream(VERBOSE ? System.out : null);
// Establish a base index of 100 docs:
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
for(int i=0;i<100;i++) {
Document d = new Document();
- d.add(newField("id", Integer.toString(i), customType));
+ d.add(newField("id", Integer.toString(i), StringField.TYPE_STORED));
d.add(newField("contents", English.intToEnglish(i), TextField.TYPE_UNSTORED));
if ((i-1)%7 == 0) {
writer.commit();
diff --git a/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java b/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
index 8a188b5..dc549cd 100644
--- a/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
+++ b/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
@@ -21,8 +21,8 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Random;
@@ -31,8 +31,9 @@
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.NumericField;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.DefaultSimilarity;
import org.apache.lucene.search.DocIdSetIterator;
@@ -46,9 +47,9 @@
import org.apache.lucene.store.RAMDirectory;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.Constants;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
-import org.apache.lucene.util.Constants;
/*
Verify we can read the pre-4.0 file format, do searches
@@ -596,12 +597,8 @@
{
Document doc = new Document();
doc.add(new TextField("content", "aaa"));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- doc.add(new Field("id", customType, Integer.toString(id)));
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ doc.add(new Field("id", StringField.TYPE_STORED, Integer.toString(id)));
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setStoreTermVectors(true);
customType2.setStoreTermVectorPositions(true);
customType2.setStoreTermVectorOffsets(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestCheckIndex.java b/lucene/src/test/org/apache/lucene/index/TestCheckIndex.java
index 2c37fda..40de7eb 100644
--- a/lucene/src/test/org/apache/lucene/index/TestCheckIndex.java
+++ b/lucene/src/test/org/apache/lucene/index/TestCheckIndex.java
@@ -38,8 +38,7 @@
Directory dir = newDirectory();
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java b/lucene/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
index dd0c4d7..9d2b2c6 100644
--- a/lucene/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
+++ b/lucene/src/test/org/apache/lucene/index/TestConcurrentMergeScheduler.java
@@ -17,16 +17,17 @@
* limitations under the License.
*/
-import org.apache.lucene.store.MockDirectoryWrapper;
+import java.io.IOException;
+
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
-
+import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.util.LuceneTestCase;
-import java.io.IOException;
public class TestConcurrentMergeScheduler extends LuceneTestCase {
@@ -77,10 +78,7 @@
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2));
writer.setInfoStream(VERBOSE ? System.out : null);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- Field idField = newField("id", "", customType);
+ Field idField = newField("id", "", StringField.TYPE_STORED);
doc.add(idField);
int extraCount = 0;
@@ -140,10 +138,7 @@
writer.setInfoStream(VERBOSE ? System.out : null);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- Field idField = newField("id", "", customType);
+ Field idField = newField("id", "", StringField.TYPE_STORED);
doc.add(idField);
for(int i=0;i<10;i++) {
if (VERBOSE) {
@@ -210,10 +205,7 @@
public void testNoWaitClose() throws IOException {
MockDirectoryWrapper directory = newDirectory();
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- Field idField = newField("id", "", customType);
+ Field idField = newField("id", "", StringField.TYPE_STORED);
doc.add(idField);
IndexWriter writer = new IndexWriter(
diff --git a/lucene/src/test/org/apache/lucene/index/TestConsistentFieldNumbers.java b/lucene/src/test/org/apache/lucene/index/TestConsistentFieldNumbers.java
index 76dabd1..875ea50 100644
--- a/lucene/src/test/org/apache/lucene/index/TestConsistentFieldNumbers.java
+++ b/lucene/src/test/org/apache/lucene/index/TestConsistentFieldNumbers.java
@@ -24,6 +24,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
@@ -38,11 +39,8 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(NoMergePolicy.COMPOUND_FILES));
Document d1 = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- d1.add(new Field("f1", customType, "first field"));
- d1.add(new Field("f2", customType, "second field"));
+ d1.add(new Field("f1", StringField.TYPE_STORED, "first field"));
+ d1.add(new Field("f2", StringField.TYPE_STORED, "second field"));
writer.addDocument(d1);
if (i == 1) {
@@ -53,8 +51,7 @@
}
Document d2 = new Document();
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setStoreTermVectors(true);
d2.add(new TextField("f2", "second field"));
d2.add(new Field("f1", customType2, "first field"));
@@ -105,23 +102,20 @@
IndexWriter writer = new IndexWriter(dir1, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(NoMergePolicy.COMPOUND_FILES));
Document d1 = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d1.add(new Field("f1", customType, "first field"));
- d1.add(new Field("f2", customType, "second field"));
+ d1.add(new Field("f1", TextField.TYPE_STORED, "first field"));
+ d1.add(new Field("f2", TextField.TYPE_STORED, "second field"));
writer.addDocument(d1);
writer.close();
writer = new IndexWriter(dir2, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(NoMergePolicy.COMPOUND_FILES));
Document d2 = new Document();
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setStoreTermVectors(true);
- d2.add(new Field("f2", customType, "second field"));
+ d2.add(new Field("f2", TextField.TYPE_STORED, "second field"));
d2.add(new Field("f1", customType2, "first field"));
- d2.add(new Field("f3", customType, "third field"));
- d2.add(new Field("f4", customType, "fourth field"));
+ d2.add(new Field("f3", TextField.TYPE_STORED, "third field"));
+ d2.add(new Field("f4", TextField.TYPE_STORED, "fourth field"));
writer.addDocument(d2);
writer.close();
@@ -167,8 +161,6 @@
public void testFieldNumberGaps() throws IOException {
int numIters = atLeast(13);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < numIters; i++) {
Directory dir = newDirectory();
{
@@ -176,8 +168,8 @@
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(
NoMergePolicy.NO_COMPOUND_FILES));
Document d = new Document();
- d.add(new Field("f1", customType, "d1 first field"));
- d.add(new Field("f2", customType, "d1 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d1 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d1 second field"));
writer.addDocument(d);
writer.close();
SegmentInfos sis = new SegmentInfos();
@@ -196,7 +188,7 @@
random.nextBoolean() ? NoMergePolicy.NO_COMPOUND_FILES
: NoMergePolicy.COMPOUND_FILES));
Document d = new Document();
- d.add(new Field("f1", customType, "d2 first field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d2 first field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3 }));
writer.addDocument(d);
writer.close();
@@ -220,8 +212,8 @@
random.nextBoolean() ? NoMergePolicy.NO_COMPOUND_FILES
: NoMergePolicy.COMPOUND_FILES));
Document d = new Document();
- d.add(new Field("f1", customType, "d3 first field"));
- d.add(new Field("f2", customType, "d3 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d3 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d3 second field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3, 4, 5 }));
writer.addDocument(d);
writer.close();
@@ -324,11 +316,9 @@
private Field getField(int number) {
int mode = number % 16;
String fieldName = "" + number;
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setTokenized(false);
FieldType customType3 = new FieldType(TextField.TYPE_UNSTORED);
@@ -336,7 +326,6 @@
FieldType customType4 = new FieldType(TextField.TYPE_UNSTORED);
customType4.setTokenized(false);
- customType4.setStored(false);
customType4.setStoreTermVectors(true);
customType4.setStoreTermVectorOffsets(true);
@@ -344,9 +333,8 @@
customType5.setStoreTermVectors(true);
customType5.setStoreTermVectorOffsets(true);
- FieldType customType6 = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType customType6 = new FieldType(TextField.TYPE_STORED);
customType6.setTokenized(false);
- customType6.setStored(true);
customType6.setStoreTermVectors(true);
customType6.setStoreTermVectorOffsets(true);
@@ -355,9 +343,8 @@
customType7.setStoreTermVectors(true);
customType7.setStoreTermVectorOffsets(true);
- FieldType customType8 = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType customType8 = new FieldType(TextField.TYPE_STORED);
customType8.setTokenized(false);
- customType8.setStored(true);
customType8.setStoreTermVectors(true);
customType8.setStoreTermVectorPositions(true);
@@ -365,9 +352,8 @@
customType9.setStoreTermVectors(true);
customType9.setStoreTermVectorPositions(true);
- FieldType customType10 = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType customType10 = new FieldType(TextField.TYPE_STORED);
customType10.setTokenized(false);
- customType10.setStored(true);
customType10.setStoreTermVectors(true);
customType10.setStoreTermVectorPositions(true);
@@ -376,8 +362,7 @@
customType11.setStoreTermVectors(true);
customType11.setStoreTermVectorPositions(true);
- FieldType customType12 = new FieldType(TextField.TYPE_UNSTORED);
- customType12.setStored(true);
+ FieldType customType12 = new FieldType(TextField.TYPE_STORED);
customType12.setStoreTermVectors(true);
customType12.setStoreTermVectorOffsets(true);
customType12.setStoreTermVectorPositions(true);
@@ -387,8 +372,7 @@
customType13.setStoreTermVectorOffsets(true);
customType13.setStoreTermVectorPositions(true);
- FieldType customType14 = new FieldType(TextField.TYPE_UNSTORED);
- customType14.setStored(true);
+ FieldType customType14 = new FieldType(TextField.TYPE_STORED);
customType14.setTokenized(false);
customType14.setStoreTermVectors(true);
customType14.setStoreTermVectorOffsets(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestCrash.java b/lucene/src/test/org/apache/lucene/index/TestCrash.java
index 98f115e..132de39 100644
--- a/lucene/src/test/org/apache/lucene/index/TestCrash.java
+++ b/lucene/src/test/org/apache/lucene/index/TestCrash.java
@@ -45,10 +45,8 @@
}
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(false);
- doc.add(newField("content", "aaa", customType));
- doc.add(newField("id", "0", customType));
+ doc.add(newField("content", "aaa", TextField.TYPE_UNSTORED));
+ doc.add(newField("id", "0", TextField.TYPE_UNSTORED));
for(int i=0;i<157;i++)
writer.addDocument(doc);
diff --git a/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java b/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java
index a4fe9b7..410f141 100644
--- a/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java
+++ b/lucene/src/test/org/apache/lucene/index/TestDirectoryReader.java
@@ -204,9 +204,7 @@
new MockAnalyzer(random)).setOpenMode(
create ? OpenMode.CREATE : OpenMode.APPEND));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(false);
- doc.add(newField("body", s, customType));
+ doc.add(newField("body", s, TextField.TYPE_UNSTORED));
iw.addDocument(doc);
iw.close();
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java b/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java
index 8c53a13..f09fe32 100644
--- a/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java
+++ b/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java
@@ -30,12 +30,13 @@
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.store.Directory;
-import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IOContext.Context;
+import org.apache.lucene.store.IOContext;
import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
@@ -123,10 +124,8 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("repeated", "repeated one", customType));
- doc.add(newField("repeated", "repeated two", customType));
+ doc.add(newField("repeated", "repeated one", TextField.TYPE_STORED));
+ doc.add(newField("repeated", "repeated two", TextField.TYPE_STORED));
writer.addDocument(doc);
writer.commit();
@@ -190,9 +189,7 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("f1", "a 5 a a", customType));
+ doc.add(newField("f1", "a 5 a a", TextField.TYPE_STORED));
writer.addDocument(doc);
writer.commit();
@@ -269,20 +266,15 @@
public void testMixedTermVectorSettingsSameField() throws Exception {
Document doc = new Document();
// f1 first without tv then with tv
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- doc.add(newField("f1", "v1", customType));
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
- customType2.setTokenized(false);
+ doc.add(newField("f1", "v1", StringField.TYPE_STORED));
+ FieldType customType2 = new FieldType(StringField.TYPE_STORED);
customType2.setStoreTermVectors(true);
customType2.setStoreTermVectorOffsets(true);
customType2.setStoreTermVectorPositions(true);
doc.add(newField("f1", "v2", customType2));
// f2 first with tv then without tv
doc.add(newField("f2", "v1", customType2));
- doc.add(newField("f2", "v2", customType));
+ doc.add(newField("f2", "v2", StringField.TYPE_STORED));
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
diff --git a/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java b/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java
index d21f8f7..5471dfc 100644
--- a/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java
+++ b/lucene/src/test/org/apache/lucene/index/TestFilterIndexReader.java
@@ -129,18 +129,16 @@
Directory directory = newDirectory();
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
Document d1 = new Document();
- d1.add(newField("default","one two", customType));
+ d1.add(newField("default","one two", TextField.TYPE_STORED));
writer.addDocument(d1);
Document d2 = new Document();
- d2.add(newField("default","one three", customType));
+ d2.add(newField("default","one three", TextField.TYPE_STORED));
writer.addDocument(d2);
Document d3 = new Document();
- d3.add(newField("default","two four", customType));
+ d3.add(newField("default","two four", TextField.TYPE_STORED));
writer.addDocument(d3);
writer.close();
diff --git a/lucene/src/test/org/apache/lucene/index/TestGlobalFieldNumbers.java b/lucene/src/test/org/apache/lucene/index/TestGlobalFieldNumbers.java
index 2fab249..3912795 100644
--- a/lucene/src/test/org/apache/lucene/index/TestGlobalFieldNumbers.java
+++ b/lucene/src/test/org/apache/lucene/index/TestGlobalFieldNumbers.java
@@ -43,8 +43,6 @@
public void testGlobalFieldNumberFiles() throws IOException {
int num = atLeast(3);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < num; i++) {
Directory dir = newDirectory();
{
@@ -52,8 +50,8 @@
new MockAnalyzer(random));
IndexWriter writer = new IndexWriter(dir, config);
Document d = new Document();
- d.add(new Field("f1", customType, "d1 first field"));
- d.add(new Field("f2", customType, "d1 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d1 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d1 second field"));
writer.addDocument(d);
for (String string : writer.getIndexFileNames()) {
assertFalse(string.endsWith(".fnx"));
@@ -67,7 +65,7 @@
assertFNXFiles(dir, "1.fnx");
d = new Document();
- d.add(new Field("f1", customType, "d2 first field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d2 first field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3 }));
writer.addDocument(d);
writer.commit();
@@ -85,8 +83,8 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d = new Document();
- d.add(new Field("f1", customType, "d3 first field"));
- d.add(new Field("f2", customType, "d3 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d3 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d3 second field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3, 4, 5 }));
writer.addDocument(d);
writer.close();
@@ -112,8 +110,6 @@
public void testIndexReaderCommit() throws IOException {
int num = atLeast(3);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < num; i++) {
Directory dir = newDirectory();
{
@@ -121,13 +117,13 @@
new MockAnalyzer(random));
IndexWriter writer = new IndexWriter(dir, config);
Document d = new Document();
- d.add(new Field("f1", customType, "d1 first field"));
- d.add(new Field("f2", customType, "d1 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d1 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d1 second field"));
writer.addDocument(d);
writer.commit();
assertFNXFiles(dir, "1.fnx");
d = new Document();
- d.add(new Field("f1", customType, "d2 first field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d2 first field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3 }));
writer.addDocument(d);
writer.commit();
@@ -155,8 +151,6 @@
public void testGlobalFieldNumberFilesAcrossCommits() throws IOException {
int num = atLeast(3);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < num; i++) {
Directory dir = newDirectory();
{
@@ -164,13 +158,13 @@
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setIndexDeletionPolicy(
new KeepAllDeletionPolicy()));
Document d = new Document();
- d.add(new Field("f1", customType, "d1 first field"));
- d.add(new Field("f2", customType, "d1 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d1 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d1 second field"));
writer.addDocument(d);
writer.commit();
assertFNXFiles(dir, "1.fnx");
d = new Document();
- d.add(new Field("f1", customType, "d2 first field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d2 first field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3 }));
writer.addDocument(d);
writer.commit();
@@ -185,8 +179,8 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d = new Document();
- d.add(new Field("f1", customType, "d3 first field"));
- d.add(new Field("f2", customType, "d3 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d3 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d3 second field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3, 4, 5 }));
writer.addDocument(d);
writer.close();
@@ -204,21 +198,19 @@
public void testGlobalFieldNumberOnOldCommit() throws IOException {
int num = atLeast(3);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < num; i++) {
Directory dir = newDirectory();
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setIndexDeletionPolicy(
new KeepAllDeletionPolicy()));
Document d = new Document();
- d.add(new Field("f1", customType, "d1 first field"));
- d.add(new Field("f2", customType, "d1 second field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d1 first field"));
+ d.add(new Field("f2", TextField.TYPE_STORED, "d1 second field"));
writer.addDocument(d);
writer.commit();
assertFNXFiles(dir, "1.fnx");
d = new Document();
- d.add(new Field("f1", customType, "d2 first field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d2 first field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3 }));
writer.addDocument(d);
assertFNXFiles(dir, "1.fnx");
@@ -232,7 +224,7 @@
new KeepAllDeletionPolicy()).setIndexCommit(listCommits.get(0)));
d = new Document();
- d.add(new Field("f1", customType, "d2 first field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d2 first field"));
d.add(new BinaryField("f3", new byte[] { 1, 2, 3 }));
writer.addDocument(d);
writer.commit();
@@ -483,9 +475,7 @@
}
Document d = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d.add(new Field("f1", customType, "d1 first field"));
+ d.add(new Field("f1", TextField.TYPE_STORED, "d1 first field"));
writer.addDocument(d);
writer.prepareCommit();
// the fnx file should still be under control of the SIS
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java b/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java
index 5b04db6..c3c9d2c 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java
@@ -17,7 +17,15 @@
* limitations under the License.
*/
-import org.apache.lucene.util.LuceneTestCase;
+import java.io.*;
+import java.util.*;
+
+import org.apache.lucene.analysis.MockAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.search.DefaultSimilarity;
import org.apache.lucene.search.Similarity;
import org.apache.lucene.store.CompoundFileDirectory;
@@ -25,14 +33,7 @@
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.MockDirectoryWrapper;
-import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.FieldType;
-import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.IndexWriterConfig.OpenMode;
-
-import java.io.*;
-import java.util.*;
+import org.apache.lucene.util.LuceneTestCase;
/*
Verify we can read the pre-2.1 file format, do searches
@@ -232,10 +233,7 @@
{
Document doc = new Document();
doc.add(newField("content", "aaa", TextField.TYPE_UNSTORED));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setIndexed(true);
- customType.setTokenized(false);
- doc.add(newField("id", Integer.toString(id), customType));
+ doc.add(newField("id", Integer.toString(id), StringField.TYPE_UNSTORED));
writer.addDocument(doc);
}
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReader.java b/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
index 9689bab..2384681 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
@@ -149,18 +149,12 @@
);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
-
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
FieldType customType3 = new FieldType();
customType3.setStored(true);
- doc.add(new Field("keyword",customType,"test1"));
- doc.add(new Field("text",customType2,"test1"));
+ doc.add(new Field("keyword",StringField.TYPE_STORED,"test1"));
+ doc.add(new Field("text",TextField.TYPE_STORED,"test1"));
doc.add(new Field("unindexed",customType3,"test1"));
doc.add(new TextField("unstored","test1"));
writer.addDocument(doc);
@@ -185,8 +179,8 @@
int mergeFactor = ((LogMergePolicy) writer.getConfig().getMergePolicy()).getMergeFactor();
for (int i = 0; i < 5*mergeFactor; i++) {
doc = new Document();
- doc.add(new Field("keyword",customType,"test1"));
- doc.add(new Field("text",customType2, "test1"));
+ doc.add(new Field("keyword",StringField.TYPE_STORED,"test1"));
+ doc.add(new Field("text",TextField.TYPE_STORED, "test1"));
doc.add(new Field("unindexed",customType3,"test1"));
doc.add(new TextField("unstored","test1"));
writer.addDocument(doc);
@@ -194,36 +188,30 @@
// new fields are in some different segments (we hope)
for (int i = 0; i < 5*mergeFactor; i++) {
doc = new Document();
- doc.add(new Field("keyword2",customType,"test1"));
- doc.add(new Field("text2",customType2, "test1"));
+ doc.add(new Field("keyword2",StringField.TYPE_STORED,"test1"));
+ doc.add(new Field("text2",TextField.TYPE_STORED, "test1"));
doc.add(new Field("unindexed2",customType3,"test1"));
doc.add(new TextField("unstored2","test1"));
writer.addDocument(doc);
}
// new termvector fields
- FieldType customType4 = new FieldType(TextField.TYPE_UNSTORED);
- customType4.setStored(true);
- FieldType customType5 = new FieldType(TextField.TYPE_UNSTORED);
- customType5.setStored(true);
+ FieldType customType5 = new FieldType(TextField.TYPE_STORED);
customType5.setStoreTermVectors(true);
- FieldType customType6 = new FieldType(TextField.TYPE_UNSTORED);
- customType6.setStored(true);
+ FieldType customType6 = new FieldType(TextField.TYPE_STORED);
customType6.setStoreTermVectors(true);
customType6.setStoreTermVectorOffsets(true);
- FieldType customType7 = new FieldType(TextField.TYPE_UNSTORED);
- customType7.setStored(true);
+ FieldType customType7 = new FieldType(TextField.TYPE_STORED);
customType7.setStoreTermVectors(true);
customType7.setStoreTermVectorPositions(true);
- FieldType customType8 = new FieldType(TextField.TYPE_UNSTORED);
- customType8.setStored(true);
+ FieldType customType8 = new FieldType(TextField.TYPE_STORED);
customType8.setStoreTermVectors(true);
customType8.setStoreTermVectorOffsets(true);
customType8.setStoreTermVectorPositions(true);
for (int i = 0; i < 5*mergeFactor; i++) {
doc = new Document();
- doc.add(new Field("tvnot",customType4,"tvnot"));
+ doc.add(new Field("tvnot",TextField.TYPE_STORED,"tvnot"));
doc.add(new Field("termvector",customType5,"termvector"));
doc.add(new Field("tvoffset",customType6,"tvoffset"));
doc.add(new Field("tvposition",customType7,"tvposition"));
@@ -302,27 +290,21 @@
// want to get some more segments here
// new termvector fields
int mergeFactor = ((LogMergePolicy) writer.getConfig().getMergePolicy()).getMergeFactor();
- FieldType customType4 = new FieldType(TextField.TYPE_UNSTORED);
- customType4.setStored(true);
- FieldType customType5 = new FieldType(TextField.TYPE_UNSTORED);
- customType5.setStored(true);
+ FieldType customType5 = new FieldType(TextField.TYPE_STORED);
customType5.setStoreTermVectors(true);
- FieldType customType6 = new FieldType(TextField.TYPE_UNSTORED);
- customType6.setStored(true);
+ FieldType customType6 = new FieldType(TextField.TYPE_STORED);
customType6.setStoreTermVectors(true);
customType6.setStoreTermVectorOffsets(true);
- FieldType customType7 = new FieldType(TextField.TYPE_UNSTORED);
- customType7.setStored(true);
+ FieldType customType7 = new FieldType(TextField.TYPE_STORED);
customType7.setStoreTermVectors(true);
customType7.setStoreTermVectorPositions(true);
- FieldType customType8 = new FieldType(TextField.TYPE_UNSTORED);
- customType8.setStored(true);
+ FieldType customType8 = new FieldType(TextField.TYPE_STORED);
customType8.setStoreTermVectors(true);
customType8.setStoreTermVectorOffsets(true);
customType8.setStoreTermVectorPositions(true);
for (int i = 0; i < 5 * mergeFactor; i++) {
Document doc = new Document();
- doc.add(new Field("tvnot",customType4,"one two two three three three"));
+ doc.add(new Field("tvnot",TextField.TYPE_STORED,"one two two three three three"));
doc.add(new Field("termvector",customType5,"one two two three three three"));
doc.add(new Field("tvoffset",customType6,"one two two three three three"));
doc.add(new Field("tvposition",customType7,"one two two three three three"));
@@ -807,17 +789,10 @@
{
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
-
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
-
FieldType customType3 = new FieldType();
customType3.setStored(true);
- doc.add(newField("keyword", "test1", customType));
- doc.add(newField("text", "test1", customType2));
+ doc.add(newField("keyword", "test1", StringField.TYPE_STORED));
+ doc.add(newField("text", "test1", TextField.TYPE_STORED));
doc.add(newField("unindexed", "test1", customType3));
doc.add(new TextField("unstored","test1"));
writer.addDocument(doc);
@@ -827,17 +802,10 @@
{
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
-
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
-
FieldType customType3 = new FieldType();
customType3.setStored(true);
- doc.add(newField("keyword2", "test1", customType));
- doc.add(newField("text2", "test1", customType2));
+ doc.add(newField("keyword2", "test1", StringField.TYPE_STORED));
+ doc.add(newField("text2", "test1", TextField.TYPE_STORED));
doc.add(newField("unindexed2", "test1", customType3));
doc.add(new TextField("unstored2","test1"));
writer.addDocument(doc);
@@ -846,25 +814,19 @@
static void addDocumentWithTermVectorFields(IndexWriter writer) throws IOException
{
Document doc = new Document();
- FieldType customType4 = new FieldType(TextField.TYPE_UNSTORED);
- customType4.setStored(true);
- FieldType customType5 = new FieldType(TextField.TYPE_UNSTORED);
- customType5.setStored(true);
+ FieldType customType5 = new FieldType(TextField.TYPE_STORED);
customType5.setStoreTermVectors(true);
- FieldType customType6 = new FieldType(TextField.TYPE_UNSTORED);
- customType6.setStored(true);
+ FieldType customType6 = new FieldType(TextField.TYPE_STORED);
customType6.setStoreTermVectors(true);
customType6.setStoreTermVectorOffsets(true);
- FieldType customType7 = new FieldType(TextField.TYPE_UNSTORED);
- customType7.setStored(true);
+ FieldType customType7 = new FieldType(TextField.TYPE_STORED);
customType7.setStoreTermVectors(true);
customType7.setStoreTermVectorPositions(true);
- FieldType customType8 = new FieldType(TextField.TYPE_UNSTORED);
- customType8.setStored(true);
+ FieldType customType8 = new FieldType(TextField.TYPE_STORED);
customType8.setStoreTermVectors(true);
customType8.setStoreTermVectorOffsets(true);
customType8.setStoreTermVectorPositions(true);
- doc.add(newField("tvnot","tvnot",customType4));
+ doc.add(newField("tvnot","tvnot",TextField.TYPE_STORED));
doc.add(newField("termvector","termvector",customType5));
doc.add(newField("tvoffset","tvoffset", customType6));
doc.add(newField("tvposition","tvposition", customType7));
@@ -1113,8 +1075,7 @@
static Document createDocument(String id) {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
customType.setOmitNorms(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReaderClone.java b/lucene/src/test/org/apache/lucene/index/TestIndexReaderClone.java
index 81064e5..4e3b3e5 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexReaderClone.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReaderClone.java
@@ -501,9 +501,7 @@
setMergePolicy(newLogMergePolicy(false))
);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("field", "yes it's stored", customType));
+ doc.add(newField("field", "yes it's stored", TextField.TYPE_STORED));
w.addDocument(doc);
w.close();
IndexReader r1 = IndexReader.open(dir, false);
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReaderDelete.java b/lucene/src/test/org/apache/lucene/index/TestIndexReaderDelete.java
index a393d04..0deedd5 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexReaderDelete.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReaderDelete.java
@@ -22,6 +22,7 @@
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
@@ -277,13 +278,11 @@
Directory dir = newDirectory();
RandomIndexWriter w= new RandomIndexWriter(random, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setTokenized(false);
- doc.add(newField("f", "doctor", customType));
+ doc.add(newField("f", "doctor", StringField.TYPE_UNSTORED));
w.addDocument(doc);
doc = new Document();
w.commit();
- doc.add(newField("f", "who", customType));
+ doc.add(newField("f", "who", StringField.TYPE_UNSTORED));
w.addDocument(doc);
IndexReader r = new SlowMultiReaderWrapper(w.getReader());
w.close();
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReaderOnDiskFull.java b/lucene/src/test/org/apache/lucene/index/TestIndexReaderOnDiskFull.java
index 24d7425..41d4b52 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexReaderOnDiskFull.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReaderOnDiskFull.java
@@ -22,6 +22,7 @@
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.search.DefaultSimilarity;
import org.apache.lucene.search.IndexSearcher;
@@ -51,12 +52,9 @@
System.out.println("TEST: create initial index");
writer.setInfoStream(System.out);
}
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
for(int i=0;i<157;i++) {
Document d = new Document();
- d.add(newField("id", Integer.toString(i), customType));
+ d.add(newField("id", Integer.toString(i), StringField.TYPE_STORED));
d.add(newField("content", "aaa " + i, TextField.TYPE_UNSTORED));
writer.addDocument(d);
if (0==i%10)
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java b/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
index c275f9a..a77b0bf 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
@@ -169,11 +169,9 @@
IndexReader reader = IndexReader.open(dir, false);
try {
int M = 3;
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setTokenized(false);
customType2.setOmitNorms(true);
FieldType customType3 = new FieldType();
@@ -967,21 +965,18 @@
Document doc = new Document();
sb.append("a");
sb.append(n);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setTokenized(false);
customType2.setOmitNorms(true);
FieldType customType3 = new FieldType();
customType3.setStored(true);
- doc.add(new Field("field1", customType, sb.toString()));
+ doc.add(new Field("field1", TextField.TYPE_STORED, sb.toString()));
doc.add(new Field("fielda", customType2, sb.toString()));
doc.add(new Field("fieldb", customType3, sb.toString()));
sb.append(" b");
sb.append(n);
for (int i = 1; i < numFields; i++) {
- doc.add(new Field("field" + (i+1), customType, sb.toString()));
+ doc.add(new Field("field" + (i+1), TextField.TYPE_STORED, sb.toString()));
}
return doc;
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
index 86cebcc..40f41a7 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
@@ -464,8 +464,7 @@
MockDirectoryWrapper dir = newDirectory();
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(10));
// Enable norms for only 1 doc, pre flush
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setOmitNorms(true);
for(int j=0;j<10;j++) {
Document doc = new Document();
@@ -528,8 +527,7 @@
b.append(" a a a a a a a a");
}
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -601,8 +599,7 @@
setMergePolicy(newLogMergePolicy(10))
);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -626,8 +623,7 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
writer.setInfoStream(VERBOSE ? System.out : null);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -707,8 +703,7 @@
Document doc = new Document();
String contents = "aa bb cc dd ee ff gg hh ii jj kk";
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
FieldType type = null;
if (i == 7) {
// Add empty docs here
@@ -747,8 +742,7 @@
Directory directory = newDirectory();
final Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
Field idField = newField("id", "", customType);
@@ -907,8 +901,7 @@
Directory dir = newDirectory();
MockIndexWriter w = new MockIndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
doc.add(newField("field", "a field", customType));
w.addDocument(doc);
w.commit();
@@ -1069,8 +1062,7 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -1249,8 +1241,7 @@
Field f = new Field("binary", customType, b, 10, 17);
f.setTokenStream(new MockTokenizer(new StringReader("doc1field1"), MockTokenizer.WHITESPACE, false));
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
Field f2 = newField("string", "value", customType2);
f2.setTokenStream(new MockTokenizer(new StringReader("doc1field2"), MockTokenizer.WHITESPACE, false));
@@ -1463,8 +1454,7 @@
// First commit
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -1526,8 +1516,7 @@
}
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -1561,8 +1550,7 @@
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -1593,8 +1581,7 @@
final List<Integer> fieldIDs = new ArrayList<Integer>();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
Field idField = newField("id", "", customType);
@@ -1690,14 +1677,11 @@
String BIG="alskjhlaksjghlaksjfhalksvjepgjioefgjnsdfjgefgjhelkgjhqewlrkhgwlekgrhwelkgjhwelkgrhwlkejg";
BIG=BIG+BIG+BIG+BIG;
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setOmitNorms(true);
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
+ FieldType customType2 = new FieldType(TextField.TYPE_STORED);
customType2.setTokenized(false);
- FieldType customType3 = new FieldType(TextField.TYPE_UNSTORED);
- customType3.setStored(true);
+ FieldType customType3 = new FieldType(TextField.TYPE_STORED);
customType3.setTokenized(false);
customType3.setOmitNorms(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
index 6205bbe..489623c 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
@@ -58,18 +58,14 @@
IndexWriter modifier = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)).setMaxBufferedDeleteTerms(1));
- FieldType custom = new FieldType(StringField.TYPE_UNSTORED);
- custom.setStored(true);
FieldType custom1 = new FieldType();
custom1.setStored(true);
- FieldType custom2 = new FieldType(TextField.TYPE_UNSTORED);
- custom2.setStored(true);
for (int i = 0; i < keywords.length; i++) {
Document doc = new Document();
- doc.add(newField("id", keywords[i], custom));
+ doc.add(newField("id", keywords[i], StringField.TYPE_STORED));
doc.add(newField("country", unindexed[i], custom1));
doc.add(newField("contents", unstored[i], TextField.TYPE_UNSTORED));
- doc.add(newField("city", text[i], custom2));
+ doc.add(newField("city", text[i], TextField.TYPE_STORED));
modifier.addDocument(doc);
}
modifier.optimize();
@@ -387,10 +383,8 @@
private void updateDoc(IndexWriter modifier, int id, int value)
throws IOException {
Document doc = new Document();
- FieldType custom = new FieldType(StringField.TYPE_UNSTORED);
- custom.setStored(true);
doc.add(newField("content", "aaa", TextField.TYPE_UNSTORED));
- doc.add(newField("id", String.valueOf(id), custom));
+ doc.add(newField("id", String.valueOf(id), StringField.TYPE_STORED));
doc.add(newField("value", String.valueOf(value), StringField.TYPE_UNSTORED));
modifier.updateDocument(new Term("id", String.valueOf(id)), doc);
}
@@ -399,10 +393,8 @@
private void addDoc(IndexWriter modifier, int id, int value)
throws IOException {
Document doc = new Document();
- FieldType custom = new FieldType(StringField.TYPE_UNSTORED);
- custom.setStored(true);
doc.add(newField("content", "aaa", TextField.TYPE_UNSTORED));
- doc.add(newField("id", String.valueOf(id), custom));
+ doc.add(newField("id", String.valueOf(id), StringField.TYPE_STORED));
doc.add(newField("value", String.valueOf(value), StringField.TYPE_UNSTORED));
modifier.addDocument(doc);
}
@@ -437,11 +429,9 @@
// TODO: find the resource leak that only occurs sometimes here.
startDir.setNoDeleteOpenFile(false);
IndexWriter writer = new IndexWriter(startDir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)));
- FieldType custom = new FieldType(StringField.TYPE_UNSTORED);
- custom.setStored(true);
for (int i = 0; i < 157; i++) {
Document d = new Document();
- d.add(newField("id", Integer.toString(i), custom));
+ d.add(newField("id", Integer.toString(i), StringField.TYPE_STORED));
d.add(newField("content", "aaa " + i, TextField.TYPE_UNSTORED));
writer.addDocument(d);
}
@@ -520,7 +510,7 @@
for (int i = 0; i < 13; i++) {
if (updates) {
Document d = new Document();
- d.add(newField("id", Integer.toString(i), custom));
+ d.add(newField("id", Integer.toString(i), StringField.TYPE_STORED));
d.add(newField("content", "bbb " + i, TextField.TYPE_UNSTORED));
modifier.updateDocument(new Term("id", Integer.toString(docId)), d);
} else { // deletes
@@ -710,18 +700,14 @@
dir.failOn(failure.reset());
- FieldType custom = new FieldType(StringField.TYPE_UNSTORED);
- custom.setStored(true);
FieldType custom1 = new FieldType();
custom1.setStored(true);
- FieldType custom2 = new FieldType(TextField.TYPE_UNSTORED);
- custom2.setStored(true);
for (int i = 0; i < keywords.length; i++) {
Document doc = new Document();
- doc.add(newField("id", keywords[i], StringField.TYPE_UNSTORED));
+ doc.add(newField("id", keywords[i], StringField.TYPE_STORED));
doc.add(newField("country", unindexed[i], custom1));
doc.add(newField("contents", unstored[i], TextField.TYPE_UNSTORED));
- doc.add(newField("city", text[i], custom2));
+ doc.add(newField("city", text[i], TextField.TYPE_STORED));
modifier.addDocument(doc);
}
// flush (and commit if ac)
@@ -835,18 +821,14 @@
modifier.commit();
dir.failOn(failure.reset());
- FieldType custom = new FieldType(StringField.TYPE_UNSTORED);
- custom.setStored(true);
FieldType custom1 = new FieldType();
custom1.setStored(true);
- FieldType custom2 = new FieldType(TextField.TYPE_UNSTORED);
- custom2.setStored(true);
for (int i = 0; i < keywords.length; i++) {
Document doc = new Document();
- doc.add(newField("id", keywords[i], custom));
+ doc.add(newField("id", keywords[i], StringField.TYPE_STORED));
doc.add(newField("country", unindexed[i], custom1));
doc.add(newField("contents", unstored[i], TextField.TYPE_UNSTORED));
- doc.add(newField("city", text[i], custom2));
+ doc.add(newField("city", text[i], TextField.TYPE_STORED));
try {
modifier.addDocument(doc);
} catch (IOException io) {
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
index c717a16..b78a34b 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
@@ -65,7 +65,7 @@
private static final FieldType custom2 = new FieldType();
private static final FieldType custom3 = new FieldType();
private static final FieldType custom4 = new FieldType(StringField.TYPE_UNSTORED);
- private static final FieldType custom5 = new FieldType(TextField.TYPE_UNSTORED);
+ private static final FieldType custom5 = new FieldType(TextField.TYPE_STORED);
static {
@@ -82,7 +82,6 @@
custom4.setStoreTermVectorPositions(true);
custom4.setStoreTermVectorOffsets(true);
- custom5.setStored(true);
custom5.setStoreTermVectors(true);
custom5.setStoreTermVectorPositions(true);
custom5.setStoreTermVectorOffsets(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterMerging.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
index f91472d..30a779b 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterMerging.java
@@ -107,12 +107,10 @@
setMergePolicy(newLogMergePolicy(2))
);
- FieldType custom = new FieldType(StringField.TYPE_UNSTORED);
- custom.setStored(true);
for (int i = start; i < (start + numDocs); i++)
{
Document temp = new Document();
- temp.add(newField("count", (""+i), custom));
+ temp.add(newField("count", (""+i), StringField.TYPE_STORED));
writer.addDocument(temp);
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java
index f1ace1f..da2bdbf 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java
@@ -478,10 +478,7 @@
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(false);
-
- doc.add(newField("f", "doctor who", customType));
+ doc.add(newField("f", "doctor who", TextField.TYPE_UNSTORED));
w.addDocument(doc);
w.commit();
@@ -517,8 +514,7 @@
.setMaxBufferedDocs(2).setMergeScheduler(new ConcurrentMergeScheduler()));
dir.setMaxSizeInBytes(Math.max(1, dir.getRecomputedActualSizeInBytes()));
final Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(false);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
doc.add(newField("field", "aaa bbb ccc ddd eee fff ggg hhh iii jjj", customType));
@@ -558,10 +554,8 @@
private void addDocWithIndex(IndexWriter writer, int index) throws IOException
{
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(false);
- doc.add(newField("content", "aaa " + index, customType));
- doc.add(newField("id", "" + index, customType));
+ doc.add(newField("content", "aaa " + index, TextField.TYPE_UNSTORED));
+ doc.add(newField("id", "" + index, TextField.TYPE_UNSTORED));
writer.addDocument(doc);
}
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java
index 5e4131b..1aa7797 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java
@@ -580,14 +580,12 @@
public static Document createDocument(int n, String indexName, int numFields) {
StringBuilder sb = new StringBuilder();
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
- FieldType customType1 = new FieldType(StringField.TYPE_UNSTORED);
- customType1.setStored(true);
+ FieldType customType1 = new FieldType(StringField.TYPE_STORED);
customType1.setStoreTermVectors(true);
customType1.setStoreTermVectorPositions(true);
customType1.setStoreTermVectorOffsets(true);
@@ -1008,9 +1006,7 @@
);
Document doc = new Document();
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(false);
- doc.add(newField("foo", "bar", customType));
+ doc.add(newField("foo", "bar", StringField.TYPE_UNSTORED));
for(int i=0;i<20;i++) {
w.addDocument(doc);
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterUnicode.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterUnicode.java
index be86d4d..e022d23 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterUnicode.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterUnicode.java
@@ -255,12 +255,9 @@
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new TestIndexWriter.StringSplitAnalyzer()));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
-
final int count = utf8Data.length/2;
for(int i=0;i<count;i++)
- doc.add(newField("f" + i, utf8Data[2*i], customType));
+ doc.add(newField("f" + i, utf8Data[2*i], TextField.TYPE_STORED));
w.addDocument(doc);
w.close();
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexWriterWithThreads.java b/lucene/src/test/org/apache/lucene/index/TestIndexWriterWithThreads.java
index 89529d1..a699f95 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexWriterWithThreads.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexWriterWithThreads.java
@@ -57,8 +57,7 @@
public void run() {
final Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -299,8 +298,7 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setMaxBufferedDocs(2).setMergeScheduler(new ConcurrentMergeScheduler()));
final Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestIndexableField.java b/lucene/src/test/org/apache/lucene/index/TestIndexableField.java
index 9326185..ea6c23c 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIndexableField.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIndexableField.java
@@ -339,4 +339,4 @@
r.close();
dir.close();
}
-}
\ No newline at end of file
+}
diff --git a/lucene/src/test/org/apache/lucene/index/TestIsCurrent.java b/lucene/src/test/org/apache/lucene/index/TestIsCurrent.java
index 6e09530..cbf4569 100644
--- a/lucene/src/test/org/apache/lucene/index/TestIsCurrent.java
+++ b/lucene/src/test/org/apache/lucene/index/TestIsCurrent.java
@@ -43,9 +43,7 @@
// write document
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("UUID", "1", customType));
+ doc.add(newField("UUID", "1", TextField.TYPE_STORED));
writer.addDocument(doc);
writer.commit();
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java b/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
index 33de148..59ed175 100755
--- a/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
+++ b/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
@@ -86,8 +86,6 @@
setMaxBufferedDocs(10).
setMergePolicy(newLogMergePolicy(false))
);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
@@ -103,7 +101,7 @@
content = this.term3 + " " + this.term2;
}
- doc.add(newField(this.field, content, customType));
+ doc.add(newField(this.field, content, TextField.TYPE_STORED));
writer.addDocument(doc);
}
@@ -150,11 +148,9 @@
public void testSeek() throws IOException {
Directory directory = newDirectory();
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < 10; i++) {
Document doc = new Document();
- doc.add(newField(this.field, "a b", customType));
+ doc.add(newField(this.field, "a b", TextField.TYPE_STORED));
writer.addDocument(doc);
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java b/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java
index 50fea81..62335eb 100644
--- a/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java
+++ b/lucene/src/test/org/apache/lucene/index/TestNoDeletionPolicy.java
@@ -72,11 +72,9 @@
IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setIndexDeletionPolicy(NoDeletionPolicy.INSTANCE));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < 10; i++) {
Document doc = new Document();
- doc.add(newField("c", "a" + i, customType));
+ doc.add(newField("c", "a" + i, TextField.TYPE_STORED));
writer.addDocument(doc);
writer.commit();
assertEquals("wrong number of commits !", i + 1, IndexReader.listCommits(dir).size());
diff --git a/lucene/src/test/org/apache/lucene/index/TestOmitNorms.java b/lucene/src/test/org/apache/lucene/index/TestOmitNorms.java
index b07dd94..865945f 100644
--- a/lucene/src/test/org/apache/lucene/index/TestOmitNorms.java
+++ b/lucene/src/test/org/apache/lucene/index/TestOmitNorms.java
@@ -226,12 +226,10 @@
*/
public void testOmitNormsCombos() throws IOException {
// indexed with norms
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
Field norms = new Field("foo", customType, "a");
// indexed without norms
- FieldType customType1 = new FieldType(TextField.TYPE_UNSTORED);
- customType1.setStored(true);
+ FieldType customType1 = new FieldType(TextField.TYPE_STORED);
customType1.setOmitNorms(true);
Field noNorms = new Field("foo", customType1, "a");
// not indexed, but stored
diff --git a/lucene/src/test/org/apache/lucene/index/TestParallelReader.java b/lucene/src/test/org/apache/lucene/index/TestParallelReader.java
index 18a467a..04f5021 100644
--- a/lucene/src/test/org/apache/lucene/index/TestParallelReader.java
+++ b/lucene/src/test/org/apache/lucene/index/TestParallelReader.java
@@ -97,9 +97,7 @@
IndexWriter w2 = new IndexWriter(dir2, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d3 = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d3.add(newField("f3", "v1", customType));
+ d3.add(newField("f3", "v1", TextField.TYPE_STORED));
w2.addDocument(d3);
w2.close();
@@ -157,9 +155,7 @@
setMergePolicy(newLogMergePolicy(10))
);
Document d = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d.add(newField("f1", "v1", customType));
+ d.add(newField("f1", "v1", TextField.TYPE_STORED));
modifier.addDocument(d);
modifier.close();
@@ -169,7 +165,7 @@
setMergePolicy(newLogMergePolicy(10))
);
d = new Document();
- d.add(newField("f2", "v2", customType));
+ d.add(newField("f2", "v2", TextField.TYPE_STORED));
modifier.addDocument(d);
modifier.close();
@@ -226,18 +222,16 @@
dir = newDirectory();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d1 = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d1.add(newField("f1", "v1", customType));
- d1.add(newField("f2", "v1", customType));
- d1.add(newField("f3", "v1", customType));
- d1.add(newField("f4", "v1", customType));
+ d1.add(newField("f1", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f2", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f3", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f4", "v1", TextField.TYPE_STORED));
w.addDocument(d1);
Document d2 = new Document();
- d2.add(newField("f1", "v2", customType));
- d2.add(newField("f2", "v2", customType));
- d2.add(newField("f3", "v2", customType));
- d2.add(newField("f4", "v2", customType));
+ d2.add(newField("f1", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f2", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f3", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f4", "v2", TextField.TYPE_STORED));
w.addDocument(d2);
w.close();
@@ -258,14 +252,12 @@
Directory dir1 = newDirectory();
IndexWriter w1 = new IndexWriter(dir1, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d1 = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- d1.add(newField("f1", "v1", customType));
- d1.add(newField("f2", "v1", customType));
+ d1.add(newField("f1", "v1", TextField.TYPE_STORED));
+ d1.add(newField("f2", "v1", TextField.TYPE_STORED));
w1.addDocument(d1);
Document d2 = new Document();
- d2.add(newField("f1", "v2", customType));
- d2.add(newField("f2", "v2", customType));
+ d2.add(newField("f1", "v2", TextField.TYPE_STORED));
+ d2.add(newField("f2", "v2", TextField.TYPE_STORED));
w1.addDocument(d2);
w1.close();
return dir1;
@@ -273,16 +265,14 @@
private Directory getDir2(Random random) throws IOException {
Directory dir2 = newDirectory();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
IndexWriter w2 = new IndexWriter(dir2, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document d3 = new Document();
- d3.add(newField("f3", "v1", customType));
- d3.add(newField("f4", "v1", customType));
+ d3.add(newField("f3", "v1", TextField.TYPE_STORED));
+ d3.add(newField("f4", "v1", TextField.TYPE_STORED));
w2.addDocument(d3);
Document d4 = new Document();
- d4.add(newField("f3", "v2", customType));
- d4.add(newField("f4", "v2", customType));
+ d4.add(newField("f3", "v2", TextField.TYPE_STORED));
+ d4.add(newField("f4", "v2", TextField.TYPE_STORED));
w2.addDocument(d4);
w2.close();
return dir2;
diff --git a/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java b/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java
index 6923a0d..fc43da1 100755
--- a/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java
+++ b/lucene/src/test/org/apache/lucene/index/TestParallelTermEnum.java
@@ -41,10 +41,8 @@
IndexWriter iw1 = new IndexWriter(rd1, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("field1", "the quick brown fox jumps", customType));
- doc.add(newField("field2", "the quick brown fox jumps", customType));
+ doc.add(newField("field1", "the quick brown fox jumps", TextField.TYPE_STORED));
+ doc.add(newField("field2", "the quick brown fox jumps", TextField.TYPE_STORED));
doc.add(newField("field4", "", TextField.TYPE_UNSTORED));
iw1.addDocument(doc);
@@ -54,8 +52,8 @@
doc = new Document();
doc.add(newField("field0", "", TextField.TYPE_UNSTORED));
- doc.add(newField("field1", "the fox jumps over the lazy dog", customType));
- doc.add(newField("field3", "the fox jumps over the lazy dog", customType));
+ doc.add(newField("field1", "the fox jumps over the lazy dog", TextField.TYPE_STORED));
+ doc.add(newField("field3", "the fox jumps over the lazy dog", TextField.TYPE_STORED));
iw2.addDocument(doc);
iw2.close();
diff --git a/lucene/src/test/org/apache/lucene/index/TestPayloads.java b/lucene/src/test/org/apache/lucene/index/TestPayloads.java
index b6b46ef..6f46d21 100644
--- a/lucene/src/test/org/apache/lucene/index/TestPayloads.java
+++ b/lucene/src/test/org/apache/lucene/index/TestPayloads.java
@@ -607,16 +607,14 @@
RandomIndexWriter writer = new RandomIndexWriter(random, dir,
new MockAnalyzer(random, MockTokenizer.WHITESPACE, true));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(new Field("hasMaybepayload", customType, "here we go"));
+ doc.add(new Field("hasMaybepayload", TextField.TYPE_STORED, "here we go"));
writer.addDocument(doc);
writer.close();
writer = new RandomIndexWriter(random, dir,
new MockAnalyzer(random, MockTokenizer.WHITESPACE, true));
doc = new Document();
- doc.add(new Field("hasMaybepayload2", customType, "here we go"));
+ doc.add(new Field("hasMaybepayload2", TextField.TYPE_STORED, "here we go"));
writer.addDocument(doc);
writer.addDocument(doc);
writer.optimize();
diff --git a/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java b/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java
index 8f6bd4b..f55b50f 100644
--- a/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java
+++ b/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java
@@ -23,9 +23,10 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
-import org.apache.lucene.index.CheckIndex.Status;
import org.apache.lucene.index.CheckIndex.Status.SegmentInfoStatus;
+import org.apache.lucene.index.CheckIndex.Status;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.codecs.Codec;
import org.apache.lucene.index.codecs.CodecProvider;
@@ -78,12 +79,10 @@
}
private void addDocs3(IndexWriter writer, int numDocs) throws IOException {
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
doc.add(newField("content", "ccc", TextField.TYPE_UNSTORED));
- doc.add(newField("id", "" + i, customType));
+ doc.add(newField("id", "" + i, StringField.TYPE_STORED));
writer.addDocument(doc);
}
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestRollback.java b/lucene/src/test/org/apache/lucene/index/TestRollback.java
index 806fcfa..1c6d479 100644
--- a/lucene/src/test/org/apache/lucene/index/TestRollback.java
+++ b/lucene/src/test/org/apache/lucene/index/TestRollback.java
@@ -20,6 +20,7 @@
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
@@ -30,12 +31,9 @@
public void testRollbackIntegrityWithBufferFlush() throws Exception {
Directory dir = newDirectory();
RandomIndexWriter rw = new RandomIndexWriter(random, dir);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setOmitNorms(true);
for (int i = 0; i < 5; i++) {
Document doc = new Document();
- doc.add(newField("pk", Integer.toString(i), customType));
+ doc.add(newField("pk", Integer.toString(i), StringField.TYPE_STORED));
rw.addDocument(doc);
}
rw.close();
@@ -46,8 +44,8 @@
for (int i = 0; i < 3; i++) {
Document doc = new Document();
String value = Integer.toString(i);
- doc.add(newField("pk", value, customType));
- doc.add(newField("text", "foo", customType));
+ doc.add(newField("pk", value, StringField.TYPE_STORED));
+ doc.add(newField("text", "foo", StringField.TYPE_STORED));
w.updateDocument(new Term("pk", value), doc);
}
w.rollback();
diff --git a/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java b/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java
index 3123669..f781545 100644
--- a/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java
+++ b/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java
@@ -43,9 +43,7 @@
Directory dir = newDirectory();
RandomIndexWriter riw = new RandomIndexWriter(random, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new BugReproAnalyzer()));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(new Field("eng", customType, "Six drunken" /*This shouldn't matter. */));
+ doc.add(new Field("eng", TextField.TYPE_STORED, "Six drunken" /*This shouldn't matter. */));
riw.addDocument(doc);
riw.close();
dir.close();
diff --git a/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java b/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java
index be11e80..1a36521 100644
--- a/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java
+++ b/lucene/src/test/org/apache/lucene/index/TestSegmentInfo.java
@@ -33,9 +33,7 @@
IndexWriter writer = new IndexWriter(dir, conf);
writer.setInfoStream(VERBOSE ? System.out : null);
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(new Field("a", customType, "value"));
+ doc.add(new Field("a", TextField.TYPE_STORED, "value"));
writer.addDocument(doc);
writer.close();
diff --git a/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.java b/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.java
index ec3215c..f9a96cf 100644
--- a/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.java
+++ b/lucene/src/test/org/apache/lucene/index/TestSnapshotDeletionPolicy.java
@@ -116,8 +116,7 @@
@Override
public void run() {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
@@ -162,8 +161,7 @@
// final segment, so deletion policy has a chance to
// delete again:
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setStoreTermVectors(true);
customType.setStoreTermVectorPositions(true);
customType.setStoreTermVectorOffsets(true);
diff --git a/lucene/src/test/org/apache/lucene/index/TestStressAdvance.java b/lucene/src/test/org/apache/lucene/index/TestStressAdvance.java
index 87a9439..f2e4c32 100644
--- a/lucene/src/test/org/apache/lucene/index/TestStressAdvance.java
+++ b/lucene/src/test/org/apache/lucene/index/TestStressAdvance.java
@@ -36,11 +36,9 @@
RandomIndexWriter w = new RandomIndexWriter(random, dir);
final Set<Integer> aDocs = new HashSet<Integer>();
final Document doc = new Document();
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
final Field f = newField("field", "", StringField.TYPE_UNSTORED);
doc.add(f);
- final Field idField = newField("id", "", customType);
+ final Field idField = newField("id", "", StringField.TYPE_STORED);
doc.add(idField);
int num = atLeast(4097);
for(int id=0;id<num;id++) {
diff --git a/lucene/src/test/org/apache/lucene/index/TestStressIndexing.java b/lucene/src/test/org/apache/lucene/index/TestStressIndexing.java
index 21b66d8..9d2689f 100644
--- a/lucene/src/test/org/apache/lucene/index/TestStressIndexing.java
+++ b/lucene/src/test/org/apache/lucene/index/TestStressIndexing.java
@@ -75,12 +75,10 @@
@Override
public void doWork() throws Exception {
// Add 10 docs:
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
for(int j=0; j<10; j++) {
Document d = new Document();
int n = random.nextInt();
- d.add(newField("id", Integer.toString(nextID++), customType));
+ d.add(newField("id", Integer.toString(nextID++), StringField.TYPE_STORED));
d.add(newField("contents", English.intToEnglish(n), TextField.TYPE_UNSTORED));
writer.addDocument(d);
}
diff --git a/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java b/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java
index f5b54e4..6fc00cc 100644
--- a/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java
+++ b/lucene/src/test/org/apache/lucene/index/TestStressIndexing2.java
@@ -136,11 +136,6 @@
return o1.name().compareTo(o2.name());
}
};
- static Comparator<IndexableField> fieldNameComparator2 = new Comparator<IndexableField>() {
- public int compare(IndexableField o1, IndexableField o2) {
- return o1.name().compareTo(o2.name());
- }
- };
// This test avoids using any extra synchronization in the multiple
// indexing threads to test that IndexWriter does correctly synchronize
@@ -258,7 +253,7 @@
ArrayList<IndexableField> fields = new ArrayList<IndexableField>();
fields.addAll(d.getFields());
// put fields in same order each time
- Collections.sort(fields, fieldNameComparator2);
+ Collections.sort(fields, fieldNameComparator);
Document d1 = new Document();
for (int i=0; i<fields.size(); i++) {
@@ -729,7 +724,7 @@
}
if (sameFieldOrder) {
- Collections.sort(fields, fieldNameComparator2);
+ Collections.sort(fields, fieldNameComparator);
} else {
// random placement of id field also
Collections.swap(fields,nextInt(fields.size()), 0);
diff --git a/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java b/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java
index 709eaa2..3abf233 100644
--- a/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java
+++ b/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java
@@ -63,8 +63,7 @@
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(1000);
- final FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
+ final FieldType customType = new FieldType(StringField.TYPE_STORED);
customType.setOmitNorms(true);
for(int i=0;i<200;i++) {
diff --git a/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java b/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java
index c089bf6..dba05cc 100644
--- a/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java
+++ b/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java
@@ -130,11 +130,9 @@
IndexDeletionPolicy sdp=new KeepAllDeletionPolicy();
IndexWriter w=new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setIndexDeletionPolicy(sdp));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for(int currentRecordId=1;currentRecordId<=100;currentRecordId++) {
Document doc=new Document();
- doc.add(newField(FIELD_RECORD_ID,""+currentRecordId,customType));
+ doc.add(newField(FIELD_RECORD_ID,""+currentRecordId,TextField.TYPE_STORED));
w.addDocument(doc);
if (currentRecordId%10 == 0) {
diff --git a/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java b/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java
index 09a79fa..03051da 100644
--- a/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java
+++ b/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java
@@ -303,9 +303,7 @@
uniqueTerms.add(term);
fieldTerms.add(new Term(field, term));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setTokenized(false);
- doc.add(newField(field, term, customType));
+ doc.add(newField(field, term, StringField.TYPE_UNSTORED));
w.addDocument(doc);
}
uniqueTermCount += uniqueTerms.size();
diff --git a/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java b/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
index 273bc4d..8866c55 100644
--- a/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
+++ b/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
@@ -486,16 +486,6 @@
final boolean isNumeric = NUMERICS.contains(value);
FixedBitSet deleted = new FixedBitSet(numValues);
Document doc = new Document();
- FieldType ft = new FieldType();
- ft.setIndexed(random.nextBoolean());
- if (ft.indexed()) {
- ft.setTokenized(random.nextBoolean());
- ft.setOmitNorms(random.nextBoolean());
- }
- else {
- ft.setStored(true);
- }
-
IndexDocValuesField valField = new IndexDocValuesField(value.name());
doc.add(valField);
final BytesRef bytesRef = new BytesRef();
diff --git a/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java b/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
index 2b5f085..0261578 100644
--- a/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
+++ b/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
@@ -118,10 +118,8 @@
/* build an index */
Document doc = new Document();
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
- Field idField = newField(random, "id", "", customType);
- Field randField = newField(random, "rand", "", customType);
+ Field idField = newField(random, "id", "", StringField.TYPE_STORED);
+ Field randField = newField(random, "rand", "", StringField.TYPE_STORED);
Field bodyField = newField(random, "body", "", StringField.TYPE_UNSTORED);
doc.add(idField);
doc.add(randField);
diff --git a/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java b/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
index 5755251..91723ae 100644
--- a/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
+++ b/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
@@ -57,17 +57,12 @@
index = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random, index);
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
-
for (int i = 0; i < data.length; i++) {
Document doc = new Document();
- doc.add(newField("id", String.valueOf(i), customType));//Field.Keyword("id",String.valueOf(i)));
- doc.add(newField("all", "all", customType));//Field.Keyword("all","all"));
+ doc.add(newField("id", String.valueOf(i), StringField.TYPE_STORED));//Field.Keyword("id",String.valueOf(i)));
+ doc.add(newField("all", "all", StringField.TYPE_STORED));//Field.Keyword("all","all"));
if (null != data[i]) {
- doc.add(newField("data", data[i], customType2));//Field.Text("data",data[i]));
+ doc.add(newField("data", data[i], TextField.TYPE_STORED));//Field.Text("data",data[i]));
}
w.addDocument(doc);
}
diff --git a/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java b/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java
index 0bbfa6f..a275fb2 100644
--- a/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java
+++ b/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java
@@ -140,16 +140,14 @@
//
Document d = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
d.add(newField(
FIELD_T,
"Optimize not deleting all files",
- customType));
+ TextField.TYPE_STORED));
d.add(newField(
FIELD_C,
"Deleted When I run an optimize in our production environment.",
- customType));
+ TextField.TYPE_STORED));
//
writer.addDocument(d);
diff --git a/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java b/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java
index 8fee9e5..ac5eb46 100644
--- a/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java
+++ b/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java
@@ -42,11 +42,9 @@
String[] values = new String[] { "1", "2", "3", "4" };
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < values.length; i++) {
Document doc = new Document();
- doc.add(newField(FIELD, values[i], customType));
+ doc.add(newField(FIELD, values[i], StringField.TYPE_STORED));
writer.addDocument(doc);
}
IndexReader ir = writer.getReader();
diff --git a/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java b/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java
index 60fb9f0..b07b832 100644
--- a/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java
+++ b/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java
@@ -57,8 +57,7 @@
// add a doc, refresh the reader, and check that its there
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
doc.add(newField("id", "1", customType));
writer.addDocument(doc);
diff --git a/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java b/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
index 76da069..01888e3 100644
--- a/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
+++ b/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
@@ -177,10 +177,7 @@
// add a doc, refresh the reader, and check that its there
Document doc = new Document();
- FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- doc.add(newField("id", "1", customType));
+ doc.add(newField("id", "1", StringField.TYPE_STORED));
writer.addDocument(doc);
reader = refreshReader(reader);
diff --git a/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java b/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
index 244b700..a02a8fb 100644
--- a/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
+++ b/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
@@ -26,6 +26,7 @@
import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -52,23 +53,18 @@
index = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, index);
RandomGen random = new RandomGen(this.random);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- customType.setTokenized(false);
- FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED);
- customType2.setStored(true);
for (int i = 0; i < INDEX_SIZE; ++i) { // don't decrease; if to low the
// problem doesn't show up
Document doc = new Document();
if ((i % 5) != 0) { // some documents must not have an entry in the first
// sort field
- doc.add(newField("publicationDate_", random.getLuceneDate(), customType));
+ doc.add(newField("publicationDate_", random.getLuceneDate(), StringField.TYPE_STORED));
}
if ((i % 7) == 0) { // some documents to match the query (see below)
- doc.add(newField("content", "test", customType2));
+ doc.add(newField("content", "test", TextField.TYPE_STORED));
}
// every document has a defined 'mandant' field
- doc.add(newField("mandant", Integer.toString(i % 3), customType));
+ doc.add(newField("mandant", Integer.toString(i % 3), StringField.TYPE_STORED));
writer.addDocument(doc);
}
reader = writer.getReader();
diff --git a/lucene/src/test/org/apache/lucene/search/TestDateFilter.java b/lucene/src/test/org/apache/lucene/search/TestDateFilter.java
index 338e0f3..493576e 100644
--- a/lucene/src/test/org/apache/lucene/search/TestDateFilter.java
+++ b/lucene/src/test/org/apache/lucene/search/TestDateFilter.java
@@ -23,6 +23,7 @@
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -49,13 +50,10 @@
Document doc = new Document();
// add time that is in the past
- FieldType customType = new FieldType(TextField.TYPE_STORED);
- customType.setTokenized(false);
- FieldType customType2 = new FieldType(TextField.TYPE_STORED);
doc.add(newField("datefield", DateTools.timeToString(now - 1000,
- DateTools.Resolution.MILLISECOND), customType));
+ DateTools.Resolution.MILLISECOND), StringField.TYPE_STORED));
doc.add(newField("body", "Today is a very sunny day in New York City",
- customType2));
+ TextField.TYPE_STORED));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
@@ -118,13 +116,10 @@
Document doc = new Document();
// add time that is in the future
- FieldType customType = new FieldType(TextField.TYPE_STORED);
- customType.setTokenized(false);
- FieldType customType2 = new FieldType(TextField.TYPE_STORED);
doc.add(newField("datefield", DateTools.timeToString(now + 888888,
- DateTools.Resolution.MILLISECOND), customType));
+ DateTools.Resolution.MILLISECOND), StringField.TYPE_STORED));
doc.add(newField("body", "Today is a very sunny day in New York City",
- customType2));
+ TextField.TYPE_STORED));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
diff --git a/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java b/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java
index 620ade0..4285c5a 100644
--- a/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java
+++ b/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java
@@ -42,7 +42,6 @@
//writer.setUseCompoundFile(false);
//writer.infoStream = System.out;
FieldType customType = new FieldType(TextField.TYPE_STORED);
- customType.setStored(true);
customType.setTokenized(false);
customType.setStoreTermVectors(true);
for (int i = 0; i < numDocs; i++) {
diff --git a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java
index 633e017..0e53a81 100644
--- a/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java
+++ b/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java
@@ -53,8 +53,7 @@
.setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setOmitNorms(true);
Field field = newField("field", "", customType);
doc.add(field);
diff --git a/lucene/src/test/org/apache/lucene/search/TestTopDocsMerge.java b/lucene/src/test/org/apache/lucene/search/TestTopDocsMerge.java
index 53a7ecb..9a25c4d 100644
--- a/lucene/src/test/org/apache/lucene/search/TestTopDocsMerge.java
+++ b/lucene/src/test/org/apache/lucene/search/TestTopDocsMerge.java
@@ -92,7 +92,7 @@
for(int docIDX=0;docIDX<numDocs;docIDX++) {
final Document doc = new Document();
- doc.add(newField("string", _TestUtil.randomRealisticUnicodeString(random), StringField.TYPE_STORED));
+ doc.add(newField("string", _TestUtil.randomRealisticUnicodeString(random), StringField.TYPE_UNSTORED));
doc.add(newField("text", content[random.nextInt(content.length)], TextField.TYPE_UNSTORED));
doc.add(new NumericField("float").setFloatValue(random.nextFloat()));
final int intValue;
diff --git a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
index 9d377bc..20e501c 100644
--- a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
+++ b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
@@ -113,11 +113,9 @@
//writer.infoStream = System.out;
for (int i = 0; i < 1000; i++) {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("field", English.intToEnglish(i), customType));
+ doc.add(newField("field", English.intToEnglish(i), TextField.TYPE_STORED));
String txt = English.intToEnglish(i) +' '+English.intToEnglish(i+1);
- doc.add(newField("field2", txt, customType));
+ doc.add(newField("field2", txt, TextField.TYPE_STORED));
writer.addDocument(doc);
}
reader = writer.getReader();
diff --git a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
index 2b9d1fb..91a4219 100644
--- a/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
+++ b/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
@@ -119,15 +119,13 @@
newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer())
.setSimilarityProvider(similarityProvider).setMergePolicy(newLogMergePolicy()));
//writer.infoStream = System.out;
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < 1000; i++) {
Document doc = new Document();
- Field noPayloadField = newField(PayloadHelper.NO_PAYLOAD_FIELD, English.intToEnglish(i), customType);
+ Field noPayloadField = newField(PayloadHelper.NO_PAYLOAD_FIELD, English.intToEnglish(i), TextField.TYPE_STORED);
//noPayloadField.setBoost(0);
doc.add(noPayloadField);
- doc.add(newField("field", English.intToEnglish(i), customType));
- doc.add(newField("multiField", English.intToEnglish(i) + " " + English.intToEnglish(i), customType));
+ doc.add(newField("field", English.intToEnglish(i), TextField.TYPE_STORED));
+ doc.add(newField("multiField", English.intToEnglish(i) + " " + English.intToEnglish(i), TextField.TYPE_STORED));
writer.addDocument(doc);
}
reader = writer.getReader();
diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java b/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java
index 625bfd1..14a21c3 100644
--- a/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java
+++ b/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java
@@ -121,9 +121,7 @@
//writer.infoStream = System.out;
for (int i = 0; i < 2000; i++) {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("field", English.intToEnglish(i), customType));
+ doc.add(newField("field", English.intToEnglish(i), TextField.TYPE_STORED));
writer.addDocument(doc);
}
reader = writer.getReader();
diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java b/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
index dbfc284..11b8986 100644
--- a/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
+++ b/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
@@ -114,9 +114,7 @@
newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()).setSimilarityProvider(similarity));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField(PayloadHelper.FIELD, "one two three one four three", customType));
+ doc.add(newField(PayloadHelper.FIELD, "one two three one four three", TextField.TYPE_STORED));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
writer.close();
@@ -381,9 +379,7 @@
newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()).setSimilarityProvider(similarity));
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField(PayloadHelper.FIELD,"xx rr yy mm pp", customType));
+ doc.add(newField(PayloadHelper.FIELD,"xx rr yy mm pp", TextField.TYPE_STORED));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
@@ -444,12 +440,10 @@
newIndexWriterConfig(TEST_VERSION_CURRENT, new PayloadAnalyzer()).setSimilarityProvider(similarity));
Document doc = null;
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for(int i = 0; i < docs.length; i++) {
doc = new Document();
String docText = docs[i];
- doc.add(newField(PayloadHelper.FIELD,docText, customType));
+ doc.add(newField(PayloadHelper.FIELD,docText, TextField.TYPE_STORED));
writer.addDocument(doc);
}
diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java b/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java
index f68e695..de0a86f 100644
--- a/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java
+++ b/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java
@@ -58,11 +58,9 @@
super.setUp();
directory = newDirectory();
RandomIndexWriter writer= new RandomIndexWriter(random, directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
- doc.add(newField(field, docFields[i], customType));
+ doc.add(newField(field, docFields[i], TextField.TYPE_STORED));
writer.addDocument(doc);
}
reader = writer.getReader();
@@ -456,12 +454,8 @@
// LUCENE-1404
private void addDoc(IndexWriter writer, String id, String text) throws IOException {
final Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- FieldType customType2 = new FieldType(StringField.TYPE_UNSTORED);
- customType2.setStored(true);
- doc.add( newField("id", id, customType2) );
- doc.add( newField("text", text, customType) );
+ doc.add( newField("id", id, StringField.TYPE_STORED) );
+ doc.add( newField("text", text, TextField.TYPE_STORED) );
writer.addDocument(doc);
}
diff --git a/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java b/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java
index 8ab76a2..9d626b9 100644
--- a/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java
+++ b/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java
@@ -92,12 +92,8 @@
final String text) throws IOException {
final Document document = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- FieldType customType2 = new FieldType(StringField.TYPE_UNSTORED);
- customType2.setStored(true);
- document.add(newField(FIELD_ID, id, customType2));
- document.add(newField(FIELD_TEXT, text, customType));
+ document.add(newField(FIELD_ID, id, StringField.TYPE_STORED));
+ document.add(newField(FIELD_TEXT, text, TextField.TYPE_STORED));
writer.addDocument(document);
}
diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java
index 1a22c2d..296d1ea 100644
--- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java
+++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java
@@ -179,8 +179,8 @@
protected Config config;
- protected FieldType valType;
- protected FieldType bodyValType;
+ protected final FieldType valType;
+ protected final FieldType bodyValType;
protected ContentSource source;
protected boolean reuseFields;
diff --git a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java
index cc9c9ec..56f1937 100644
--- a/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java
+++ b/modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java
@@ -183,9 +183,7 @@
FieldType ft = new FieldType(TextField.TYPE_UNSTORED);
ft.setOmitNorms(true);
parentStreamField = new Field(Consts.FIELD_PAYLOADS, ft, parentStream);
- FieldType ft2 = new FieldType(StringField.TYPE_STORED);
- ft2.setIndexOptions(IndexOptions.DOCS_ONLY);
- fullPathField = new Field(Consts.FULL, ft2, "");
+ fullPathField = new Field(Consts.FULL, StringField.TYPE_STORED, "");
this.nextID = indexWriter.maxDoc();
diff --git a/modules/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java b/modules/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java
index f31cfef..2b3d035 100644
--- a/modules/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java
+++ b/modules/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java
@@ -710,7 +710,10 @@
IndexableField fields[] = d.getFields(fieldName);
if (fields != null) {
for (int j = 0; j < fields.length; j++) {
- addTermFrequencies(new StringReader(fields[j].stringValue()), termFreqMap, fieldName);
+ final String stringValue = fields[j].stringValue();
+ if (stringValue != null) {
+ addTermFrequencies(new StringReader(stringValue), termFreqMap, fieldName);
+ }
}
}
} else {
diff --git a/modules/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java b/modules/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
index 9c016ec..0c47f9a 100644
--- a/modules/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
+++ b/modules/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java
@@ -133,8 +133,7 @@
Field f;
int scoreAndID = i + 1;
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
customType.setTokenized(false);
customType.setOmitNorms(true);
diff --git a/modules/queries/src/test/org/apache/lucene/queries/mlt/TestMoreLikeThis.java b/modules/queries/src/test/org/apache/lucene/queries/mlt/TestMoreLikeThis.java
index 800608f..46dc627 100644
--- a/modules/queries/src/test/org/apache/lucene/queries/mlt/TestMoreLikeThis.java
+++ b/modules/queries/src/test/org/apache/lucene/queries/mlt/TestMoreLikeThis.java
@@ -68,9 +68,7 @@
private void addDoc(RandomIndexWriter writer, String text) throws IOException {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
- doc.add(newField("text", text, customType));
+ doc.add(newField("text", text, TextField.TYPE_STORED));
writer.addDocument(doc);
}
diff --git a/modules/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java b/modules/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java
index 47ec5f5..056667a 100644
--- a/modules/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java
+++ b/modules/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java
@@ -114,12 +114,10 @@
super.setUp();
rd = newDirectory();
IndexWriter w = new IndexWriter(rd, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer));
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
- customType.setStored(true);
for (int i = 0; i < docsContent.length; i++) {
Document doc = new Document();
- doc.add(newField("name", docsContent[i].name, customType));
- doc.add(newField("id", docsContent[i].id, customType));
+ doc.add(newField("name", docsContent[i].name, TextField.TYPE_STORED));
+ doc.add(newField("id", docsContent[i].id, TextField.TYPE_STORED));
w.addDocument(doc);
}
w.close();
diff --git a/modules/queryparser/src/test/org/apache/lucene/queryparser/surround/query/SingleFieldTestDb.java b/modules/queryparser/src/test/org/apache/lucene/queryparser/surround/query/SingleFieldTestDb.java
index a7a6cbc..10a8b9f 100644
--- a/modules/queryparser/src/test/org/apache/lucene/queryparser/surround/query/SingleFieldTestDb.java
+++ b/modules/queryparser/src/test/org/apache/lucene/queryparser/surround/query/SingleFieldTestDb.java
@@ -45,7 +45,7 @@
new MockAnalyzer(random)));
for (int j = 0; j < docs.length; j++) {
Document d = new Document();
- d.add(new Field(fieldName, TextField.TYPE_UNSTORED, docs[j]));
+ d.add(new TextField(fieldName, docs[j]));
writer.addDocument(d);
}
writer.close();
diff --git a/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java b/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
index 3a71c07..a92c2dc 100644
--- a/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
+++ b/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
@@ -556,7 +556,7 @@
assertU(commit());
SolrCore core = h.getCore();
- SolrQueryRequest req = req("q", "title:keyword" , "fl", "id,title,test_hlt");
+ SolrQueryRequest req = req("q", "title:keyword", "fl", "id,title,test_hlt");
SolrQueryResponse rsp = new SolrQueryResponse();
core.execute(core.getRequestHandler(req.getParams().get(CommonParams.QT)), req, rsp);
@@ -586,7 +586,6 @@
DocIterator di = dl.iterator();
Document d = req.getSearcher().doc(di.nextDoc());
// ensure field is lazy
- System.out.println(d.getField("test_hlt").getClass());
assertTrue( ((Field) d.getField("test_hlt")).getClass().getSimpleName().equals("LazyField"));
assertFalse( ((Field) d.getField("title")).getClass().getSimpleName().equals("LazyField"));
req.close();
diff --git a/solr/core/src/test/org/apache/solr/search/TestSort.java b/solr/core/src/test/org/apache/solr/search/TestSort.java
index 3ec2e2e..8347e24 100755
--- a/solr/core/src/test/org/apache/solr/search/TestSort.java
+++ b/solr/core/src/test/org/apache/solr/search/TestSort.java
@@ -150,8 +150,8 @@
public void testSort() throws Exception {
Directory dir = new RAMDirectory();
- Field f = new Field("f",StringField.TYPE_UNSTORED,"0");
- Field f2 = new Field("f2",StringField.TYPE_UNSTORED,"0");
+ Field f = new Field("f", StringField.TYPE_UNSTORED,"0");
+ Field f2 = new Field("f2", StringField.TYPE_UNSTORED,"0");
for (int iterCnt = 0; iterCnt<iter; iterCnt++) {
IndexWriter iw = new IndexWriter(