You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/06/10 20:27:17 UTC
svn commit: r1348639 [5/8] - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/analysis/ lucene/analysis/common/
lucene/analysis/common/src/test/org/apache/lucene/analysis/core/
lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneou...
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFilteredSearch.java Sun Jun 10 18:27:08 2012
@@ -19,10 +19,10 @@ package org.apache.lucene.search;
import java.io.IOException;
+import org.apache.lucene.document.Field;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.StringField;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
@@ -67,7 +67,7 @@ public class TestFilteredSearch extends
try {
for (int i = 0; i < 60; i++) {//Simple docs
Document doc = new Document();
- doc.add(newField(FIELD, Integer.toString(i), StringField.TYPE_STORED));
+ doc.add(newStringField(FIELD, Integer.toString(i), Field.Store.YES));
writer.addDocument(doc);
}
if (fullMerge) {
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFuzzyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFuzzyQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFuzzyQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestFuzzyQuery.java Sun Jun 10 18:27:08 2012
@@ -23,7 +23,7 @@ import java.io.IOException;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -324,7 +324,7 @@ public class TestFuzzyQuery extends Luce
private void addDoc(String text, RandomIndexWriter writer) throws IOException {
Document doc = new Document();
- doc.add(newField("field", text, TextField.TYPE_STORED));
+ doc.add(newTextField("field", text, Field.Store.YES));
writer.addDocument(doc);
}
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java Sun Jun 10 18:27:08 2012
@@ -22,7 +22,6 @@ import org.apache.lucene.analysis.Analyz
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
@@ -99,7 +98,7 @@ public class TestMatchAllDocsQuery exten
private void addDoc(String text, IndexWriter iw, float boost) throws IOException {
Document doc = new Document();
- Field f = newField("key", text, TextField.TYPE_STORED);
+ Field f = newTextField("key", text, Field.Store.YES);
f.setBoost(boost);
doc.add(f);
iw.addDocument(doc);
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java Sun Jun 10 18:27:08 2012
@@ -23,6 +23,7 @@ import java.util.LinkedList;
import org.apache.lucene.analysis.CannedTokenStream;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
@@ -197,7 +198,7 @@ public class TestMultiPhraseQuery extend
private void add(String s, RandomIndexWriter writer) throws IOException {
Document doc = new Document();
- doc.add(newField("body", s, TextField.TYPE_STORED));
+ doc.add(newTextField("body", s, Field.Store.YES));
writer.addDocument(doc);
}
@@ -317,8 +318,8 @@ public class TestMultiPhraseQuery extend
private void add(String s, String type, RandomIndexWriter writer)
throws IOException {
Document doc = new Document();
- doc.add(newField("body", s, TextField.TYPE_STORED));
- doc.add(newField("type", type, StringField.TYPE_UNSTORED));
+ doc.add(newTextField("body", s, Field.Store.YES));
+ doc.add(newStringField("type", type, Field.Store.NO));
writer.addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java Sun Jun 10 18:27:08 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.search;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicReaderContext;
@@ -27,7 +28,6 @@ import org.apache.lucene.index.IndexRead
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.similarities.DefaultSimilarity;
-import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -67,7 +67,7 @@ public class TestMultiTermConstantScore
doc.add(newField("id", String.valueOf(i), customType));// Field.Keyword("id",String.valueOf(i)));
doc.add(newField("all", "all", customType));// Field.Keyword("all","all"));
if (null != data[i]) {
- doc.add(newField("data", data[i], TextField.TYPE_STORED));// Field.Text("data",data[i]));
+ doc.add(newTextField("data", data[i], Field.Store.YES));// Field.Text("data",data[i]));
}
writer.addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java Sun Jun 10 18:27:08 2012
@@ -19,7 +19,7 @@ package org.apache.lucene.search;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiReader;
@@ -53,7 +53,7 @@ public class TestMultiTermQueryRewrites
for (int i = 0; i < 10; i++) {
Document doc = new Document();
- doc.add(newField("data", Integer.toString(i), StringField.TYPE_UNSTORED));
+ doc.add(newStringField("data", Integer.toString(i), Field.Store.NO));
writer.addDocument(doc);
((i % 2 == 0) ? swriter1 : swriter2).addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java Sun Jun 10 18:27:08 2012
@@ -23,8 +23,8 @@ import java.text.DecimalFormatSymbols;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.IntField;
-import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.store.Directory;
@@ -51,8 +51,8 @@ public class TestMultiValuedNumericRange
Document doc = new Document();
for (int m=0, c=random().nextInt(10); m<=c; m++) {
int value = random().nextInt(Integer.MAX_VALUE);
- doc.add(newField("asc", format.format(value), StringField.TYPE_UNSTORED));
- doc.add(new IntField("trie", value));
+ doc.add(newStringField("asc", format.format(value), Field.Store.NO));
+ doc.add(new IntField("trie", value, Field.Store.NO));
}
writer.addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNRTManager.java Sun Jun 10 18:27:08 2012
@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.Atomi
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
@@ -304,7 +304,7 @@ public class TestNRTManager extends Thre
final NRTManager.TrackingIndexWriter writer = new NRTManager.TrackingIndexWriter(_writer);
final NRTManager manager = new NRTManager(writer, null, false);
Document doc = new Document();
- doc.add(newField("test","test", TextField.TYPE_STORED));
+ doc.add(newTextField("test", "test", Field.Store.YES));
long gen = writer.addDocument(doc);
manager.maybeRefresh();
assertFalse(gen < manager.getCurrentSearchingGen());
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNot.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNot.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNot.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNot.java Sun Jun 10 18:27:08 2012
@@ -17,6 +17,7 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.Term;
import org.apache.lucene.util.LuceneTestCase;
@@ -24,7 +25,6 @@ import org.apache.lucene.index.IndexRead
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
/** Similarity unit test.
*
@@ -37,7 +37,7 @@ public class TestNot extends LuceneTestC
RandomIndexWriter writer = new RandomIndexWriter(random(), store);
Document d1 = new Document();
- d1.add(newField("field", "a b", TextField.TYPE_STORED));
+ d1.add(newTextField("field", "a b", Field.Store.YES));
writer.addDocument(d1);
IndexReader reader = writer.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java Sun Jun 10 18:27:08 2012
@@ -19,6 +19,7 @@ package org.apache.lucene.search;
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.FloatField;
import org.apache.lucene.document.IntField;
@@ -62,7 +63,7 @@ public class TestNumericRangeQuery32 ext
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 100, 1000))
.setMergePolicy(newLogMergePolicy()));
- final FieldType storedInt = new FieldType(IntField.TYPE);
+ final FieldType storedInt = new FieldType(IntField.TYPE_NOT_STORED);
storedInt.setStored(true);
storedInt.freeze();
@@ -78,7 +79,7 @@ public class TestNumericRangeQuery32 ext
final FieldType storedIntNone = new FieldType(storedInt);
storedIntNone.setNumericPrecisionStep(Integer.MAX_VALUE);
- final FieldType unstoredInt = IntField.TYPE;
+ final FieldType unstoredInt = IntField.TYPE_NOT_STORED;
final FieldType unstoredInt8 = new FieldType(unstoredInt);
unstoredInt8.setNumericPrecisionStep(8);
@@ -303,23 +304,23 @@ public class TestNumericRangeQuery32 ext
RandomIndexWriter writer = new RandomIndexWriter(random(), dir,
newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random())));
Document doc = new Document();
- doc.add(new FloatField("float", Float.NEGATIVE_INFINITY));
- doc.add(new IntField("int", Integer.MIN_VALUE));
+ doc.add(new FloatField("float", Float.NEGATIVE_INFINITY, Field.Store.NO));
+ doc.add(new IntField("int", Integer.MIN_VALUE, Field.Store.NO));
writer.addDocument(doc);
doc = new Document();
- doc.add(new FloatField("float", Float.POSITIVE_INFINITY));
- doc.add(new IntField("int", Integer.MAX_VALUE));
+ doc.add(new FloatField("float", Float.POSITIVE_INFINITY, Field.Store.NO));
+ doc.add(new IntField("int", Integer.MAX_VALUE, Field.Store.NO));
writer.addDocument(doc);
doc = new Document();
- doc.add(new FloatField("float", 0.0f));
- doc.add(new IntField("int", 0));
+ doc.add(new FloatField("float", 0.0f, Field.Store.NO));
+ doc.add(new IntField("int", 0, Field.Store.NO));
writer.addDocument(doc);
for (float f : TestNumericUtils.FLOAT_NANs) {
doc = new Document();
- doc.add(new FloatField("float", f));
+ doc.add(new FloatField("float", f, Field.Store.NO));
writer.addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java Sun Jun 10 18:27:08 2012
@@ -20,6 +20,7 @@ package org.apache.lucene.search;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.DoubleField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.LongField;
import org.apache.lucene.index.AtomicReaderContext;
@@ -62,7 +63,7 @@ public class TestNumericRangeQuery64 ext
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 100, 1000))
.setMergePolicy(newLogMergePolicy()));
- final FieldType storedLong = new FieldType(LongField.TYPE);
+ final FieldType storedLong = new FieldType(LongField.TYPE_NOT_STORED);
storedLong.setStored(true);
storedLong.freeze();
@@ -81,7 +82,7 @@ public class TestNumericRangeQuery64 ext
final FieldType storedLongNone = new FieldType(storedLong);
storedLongNone.setNumericPrecisionStep(Integer.MAX_VALUE);
- final FieldType unstoredLong = LongField.TYPE;
+ final FieldType unstoredLong = LongField.TYPE_NOT_STORED;
final FieldType unstoredLong8 = new FieldType(unstoredLong);
unstoredLong8.setNumericPrecisionStep(8);
@@ -328,23 +329,23 @@ public class TestNumericRangeQuery64 ext
RandomIndexWriter writer = new RandomIndexWriter(random(), dir,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random())));
Document doc = new Document();
- doc.add(new DoubleField("double", Double.NEGATIVE_INFINITY));
- doc.add(new LongField("long", Long.MIN_VALUE));
+ doc.add(new DoubleField("double", Double.NEGATIVE_INFINITY, Field.Store.NO));
+ doc.add(new LongField("long", Long.MIN_VALUE, Field.Store.NO));
writer.addDocument(doc);
doc = new Document();
- doc.add(new DoubleField("double", Double.POSITIVE_INFINITY));
- doc.add(new LongField("long", Long.MAX_VALUE));
+ doc.add(new DoubleField("double", Double.POSITIVE_INFINITY, Field.Store.NO));
+ doc.add(new LongField("long", Long.MAX_VALUE, Field.Store.NO));
writer.addDocument(doc);
doc = new Document();
- doc.add(new DoubleField("double", 0.0));
- doc.add(new LongField("long", 0L));
+ doc.add(new DoubleField("double", 0.0, Field.Store.NO));
+ doc.add(new LongField("long", 0L, Field.Store.NO));
writer.addDocument(doc);
for (double d : TestNumericUtils.DOUBLE_NANs) {
doc = new Document();
- doc.add(new DoubleField("double", d));
+ doc.add(new DoubleField("double", d, Field.Store.NO));
writer.addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java Sun Jun 10 18:27:08 2012
@@ -17,9 +17,9 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import org.apache.lucene.document.Field;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.index.IndexReader;
@@ -47,11 +47,11 @@ public class TestPhrasePrefixQuery exten
Document doc3 = new Document();
Document doc4 = new Document();
Document doc5 = new Document();
- doc1.add(newField("body", "blueberry pie", TextField.TYPE_STORED));
- doc2.add(newField("body", "blueberry strudel", TextField.TYPE_STORED));
- doc3.add(newField("body", "blueberry pizza", TextField.TYPE_STORED));
- doc4.add(newField("body", "blueberry chewing gum", TextField.TYPE_STORED));
- doc5.add(newField("body", "piccadilly circus", TextField.TYPE_STORED));
+ doc1.add(newTextField("body", "blueberry pie", Field.Store.YES));
+ doc2.add(newTextField("body", "blueberry strudel", Field.Store.YES));
+ doc3.add(newTextField("body", "blueberry pizza", Field.Store.YES));
+ doc4.add(newTextField("body", "blueberry chewing gum", Field.Store.YES));
+ doc5.add(newTextField("body", "piccadilly circus", Field.Store.YES));
writer.addDocument(doc1);
writer.addDocument(doc2);
writer.addDocument(doc3);
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java Sun Jun 10 18:27:08 2012
@@ -72,19 +72,19 @@ public class TestPhraseQuery extends Luc
RandomIndexWriter writer = new RandomIndexWriter(random(), directory, analyzer);
Document doc = new Document();
- doc.add(newField("field", "one two three four five", TextField.TYPE_STORED));
- doc.add(newField("repeated", "this is a repeated field - first part", TextField.TYPE_STORED));
- IndexableField repeatedField = newField("repeated", "second part of a repeated field", TextField.TYPE_STORED);
+ doc.add(newTextField("field", "one two three four five", Field.Store.YES));
+ doc.add(newTextField("repeated", "this is a repeated field - first part", Field.Store.YES));
+ IndexableField repeatedField = newTextField("repeated", "second part of a repeated field", Field.Store.YES);
doc.add(repeatedField);
- doc.add(newField("palindrome", "one two three two one", TextField.TYPE_STORED));
+ doc.add(newTextField("palindrome", "one two three two one", Field.Store.YES));
writer.addDocument(doc);
doc = new Document();
- doc.add(newField("nonexist", "phrase exist notexist exist found", TextField.TYPE_STORED));
+ doc.add(newTextField("nonexist", "phrase exist notexist exist found", Field.Store.YES));
writer.addDocument(doc);
doc = new Document();
- doc.add(newField("nonexist", "phrase exist notexist exist found", TextField.TYPE_STORED));
+ doc.add(newTextField("nonexist", "phrase exist notexist exist found", Field.Store.YES));
writer.addDocument(doc);
reader = writer.getReader();
@@ -226,7 +226,7 @@ public class TestPhraseQuery extends Luc
RandomIndexWriter writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig( Version.LUCENE_40, stopAnalyzer));
Document doc = new Document();
- doc.add(newField("field", "the stop words are here", TextField.TYPE_STORED));
+ doc.add(newTextField("field", "the stop words are here", Field.Store.YES));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
writer.close();
@@ -260,12 +260,12 @@ public class TestPhraseQuery extends Luc
RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
Document doc = new Document();
- doc.add(newField("source", "marketing info", TextField.TYPE_STORED));
+ doc.add(newTextField("source", "marketing info", Field.Store.YES));
writer.addDocument(doc);
doc = new Document();
- doc.add(newField("contents", "foobar", TextField.TYPE_STORED));
- doc.add(newField("source", "marketing info", TextField.TYPE_STORED));
+ doc.add(newTextField("contents", "foobar", Field.Store.YES));
+ doc.add(newTextField("source", "marketing info", Field.Store.YES));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
@@ -295,15 +295,15 @@ public class TestPhraseQuery extends Luc
writer = new RandomIndexWriter(random(), directory,
newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random())).setOpenMode(OpenMode.CREATE));
doc = new Document();
- doc.add(newField("contents", "map entry woo", TextField.TYPE_STORED));
+ doc.add(newTextField("contents", "map entry woo", Field.Store.YES));
writer.addDocument(doc);
doc = new Document();
- doc.add(newField("contents", "woo map entry", TextField.TYPE_STORED));
+ doc.add(newTextField("contents", "woo map entry", Field.Store.YES));
writer.addDocument(doc);
doc = new Document();
- doc.add(newField("contents", "map foobarword entry woo", TextField.TYPE_STORED));
+ doc.add(newTextField("contents", "map foobarword entry woo", Field.Store.YES));
writer.addDocument(doc);
reader = writer.getReader();
@@ -348,15 +348,15 @@ public class TestPhraseQuery extends Luc
.setSimilarity(new DefaultSimilarity()));
Document doc = new Document();
- doc.add(newField("field", "foo firstname lastname foo", TextField.TYPE_STORED));
+ doc.add(newTextField("field", "foo firstname lastname foo", Field.Store.YES));
writer.addDocument(doc);
Document doc2 = new Document();
- doc2.add(newField("field", "foo firstname zzz lastname foo", TextField.TYPE_STORED));
+ doc2.add(newTextField("field", "foo firstname zzz lastname foo", Field.Store.YES));
writer.addDocument(doc2);
Document doc3 = new Document();
- doc3.add(newField("field", "foo firstname zzz yyy lastname foo", TextField.TYPE_STORED));
+ doc3.add(newTextField("field", "foo firstname zzz yyy lastname foo", Field.Store.YES));
writer.addDocument(doc3);
IndexReader reader = writer.getReader();
@@ -611,7 +611,7 @@ public class TestPhraseQuery extends Luc
RandomIndexWriter w = new RandomIndexWriter(random(), dir, newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer).setMergePolicy(newLogMergePolicy()));
List<List<String>> docs = new ArrayList<List<String>>();
Document d = new Document();
- Field f = newField("f", "", TextField.TYPE_UNSTORED);
+ Field f = newTextField("f", "", Field.Store.NO);
d.add(f);
Random r = random();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPositionIncrement.java Sun Jun 10 18:27:08 2012
@@ -27,6 +27,7 @@ import org.apache.lucene.analysis.tokena
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.MultiFields;
@@ -91,7 +92,7 @@ public class TestPositionIncrement exten
Directory store = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), store, analyzer);
Document d = new Document();
- d.add(newField("field", "bogus", TextField.TYPE_STORED));
+ d.add(newTextField("field", "bogus", Field.Store.YES));
writer.addDocument(d);
IndexReader reader = writer.getReader();
writer.close();
@@ -207,7 +208,7 @@ public class TestPositionIncrement exten
RandomIndexWriter writer = new RandomIndexWriter(random(), dir, new MockPayloadAnalyzer());
Document doc = new Document();
doc.add(new TextField("content", new StringReader(
- "a a b c d e a f g h i j a b k k")));
+ "a a b c d e a f g h i j a b k k"), Field.Store.NO));
writer.addDocument(doc);
final IndexReader readerFromWriter = writer.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixFilter.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixFilter.java Sun Jun 10 18:27:08 2012
@@ -17,13 +17,13 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import org.apache.lucene.document.Field;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.store.Directory;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.StringField;
/**
* Tests {@link PrefixFilter} class.
@@ -40,7 +40,7 @@ public class TestPrefixFilter extends Lu
RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
for (int i = 0; i < categories.length; i++) {
Document doc = new Document();
- doc.add(newField("category", categories[i], StringField.TYPE_STORED));
+ doc.add(newStringField("category", categories[i], Field.Store.YES));
writer.addDocument(doc);
}
IndexReader reader = writer.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java Sun Jun 10 18:27:08 2012
@@ -19,7 +19,6 @@ package org.apache.lucene.search;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -28,7 +27,6 @@ import org.apache.lucene.util.LuceneTest
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeaks;
/**
* https://issues.apache.org/jira/browse/LUCENE-1974
@@ -52,7 +50,7 @@ public class TestPrefixInBooleanQuery ex
RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
Document doc = new Document();
- Field field = newField(FIELD, "meaninglessnames", StringField.TYPE_UNSTORED);
+ Field field = newStringField(FIELD, "meaninglessnames", Field.Store.NO);
doc.add(field);
for (int i = 0; i < 5137; ++i) {
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixQuery.java Sun Jun 10 18:27:08 2012
@@ -17,6 +17,7 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import org.apache.lucene.document.Field;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.index.IndexReader;
@@ -25,7 +26,6 @@ import org.apache.lucene.index.RandomInd
import org.apache.lucene.index.Term;
import org.apache.lucene.index.Terms;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.StringField;
/**
* Tests {@link PrefixQuery} class.
@@ -41,7 +41,7 @@ public class TestPrefixQuery extends Luc
RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
for (int i = 0; i < categories.length; i++) {
Document doc = new Document();
- doc.add(newField("category", categories[i], StringField.TYPE_STORED));
+ doc.add(newStringField("category", categories[i], Field.Store.YES));
writer.addDocument(doc);
}
IndexReader reader = writer.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestPrefixRandom.java Sun Jun 10 18:27:08 2012
@@ -24,7 +24,6 @@ import org.apache.lucene.analysis.MockTo
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StringField;
import org.apache.lucene.index.FilteredTermsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -56,7 +55,7 @@ public class TestPrefixRandom extends Lu
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 50, 1000)));
Document doc = new Document();
- Field field = newField("field", "", StringField.TYPE_UNSTORED);
+ Field field = newStringField("field", "", Field.Store.NO);
doc.add(field);
// we generate aweful prefixes: good for testing.
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestQueryWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestQueryWrapperFilter.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestQueryWrapperFilter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestQueryWrapperFilter.java Sun Jun 10 18:27:08 2012
@@ -21,8 +21,6 @@ import java.util.Set;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -37,7 +35,7 @@ public class TestQueryWrapperFilter exte
Directory dir = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- doc.add(newField("field", "value", TextField.TYPE_UNSTORED));
+ doc.add(newTextField("field", "value", Field.Store.NO));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
writer.close();
@@ -100,9 +98,9 @@ public class TestQueryWrapperFilter exte
} else {
v = "b";
}
- final Field f = newField("field", v, StringField.TYPE_UNSTORED);
+ final Field f = newStringField("field", v, Field.Store.NO);
doc.add(f);
- doc.add(newField("id", ""+i, StringField.TYPE_STORED));
+ doc.add(newStringField("id", ""+i, Field.Store.YES));
w.addDocument(doc);
}
@@ -131,7 +129,7 @@ public class TestQueryWrapperFilter exte
RandomIndexWriter writer = new RandomIndexWriter(random(), dir);
for (int i = 0; i < 1000; i++) {
Document doc = new Document();
- doc.add(newField("field", English.intToEnglish(i), StringField.TYPE_UNSTORED));
+ doc.add(newStringField("field", English.intToEnglish(i), Field.Store.NO));
writer.addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpQuery.java Sun Jun 10 18:27:08 2012
@@ -21,7 +21,7 @@ import java.io.IOException;
import java.util.Arrays;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -48,9 +48,7 @@ public class TestRegexpQuery extends Luc
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random(), directory);
Document doc = new Document();
- doc.add(newField(FN,
- "the quick brown fox jumps over the lazy ??? dog 493432 49344",
- TextField.TYPE_UNSTORED));
+ doc.add(newTextField(FN, "the quick brown fox jumps over the lazy ??? dog 493432 49344", Field.Store.NO));
writer.addDocument(doc);
reader = writer.getReader();
writer.close();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestRegexpRandom2.java Sun Jun 10 18:27:08 2012
@@ -27,7 +27,6 @@ import org.apache.lucene.analysis.MockTo
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StringField;
import org.apache.lucene.index.FilteredTermsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -66,7 +65,7 @@ public class TestRegexpRandom2 extends L
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(), MockTokenizer.KEYWORD, false))
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 50, 1000)));
Document doc = new Document();
- Field field = newField(fieldName, "", StringField.TYPE_UNSTORED);
+ Field field = newStringField(fieldName, "", Field.Store.NO);
doc.add(field);
List<String> terms = new ArrayList<String>();
int num = atLeast(200);
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestScorerPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestScorerPerf.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestScorerPerf.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestScorerPerf.java Sun Jun 10 18:27:08 2012
@@ -1,5 +1,6 @@
package org.apache.lucene.search;
+import org.apache.lucene.document.Field;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.DocIdBitSet;
import org.apache.lucene.util.LuceneTestCase;
@@ -16,7 +17,6 @@ import org.apache.lucene.index.IndexWrit
import org.apache.lucene.store.Directory;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.StringField;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -70,7 +70,7 @@ public class TestScorerPerf extends Luce
Document d = new Document();
for (int j=0; j<nTerms; j++) {
if (random().nextInt(freq[j]) == 0) {
- d.add(newField("f", terms[j].text(), StringField.TYPE_UNSTORED));
+ d.add(newStringField("f", terms[j].text(), Field.Store.NO));
//System.out.println(d);
}
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchAfter.java Sun Jun 10 18:27:08 2012
@@ -22,6 +22,7 @@ import java.util.Arrays;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.DoubleField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.FloatDocValuesField;
import org.apache.lucene.document.FloatField;
import org.apache.lucene.document.IntDocValuesField;
@@ -29,8 +30,6 @@ import org.apache.lucene.document.IntFie
import org.apache.lucene.document.LongField;
import org.apache.lucene.document.SortedBytesDocValuesField;
import org.apache.lucene.document.StraightBytesDocValuesField;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -64,18 +63,18 @@ public class TestSearchAfter extends Luc
int numDocs = atLeast(200);
for (int i = 0; i < numDocs; i++) {
Document document = new Document();
- document.add(newField("english", English.intToEnglish(i), TextField.TYPE_UNSTORED));
- document.add(newField("oddeven", (i % 2 == 0) ? "even" : "odd", TextField.TYPE_UNSTORED));
- document.add(newField("byte", "" + ((byte) random().nextInt()), StringField.TYPE_UNSTORED));
- document.add(newField("short", "" + ((short) random().nextInt()), StringField.TYPE_UNSTORED));
- document.add(new IntField("int", random().nextInt()));
- document.add(new LongField("long", random().nextLong()));
-
- document.add(new FloatField("float", random().nextFloat()));
- document.add(new DoubleField("double", random().nextDouble()));
- document.add(newField("bytes", _TestUtil.randomRealisticUnicodeString(random()), StringField.TYPE_UNSTORED));
- document.add(newField("bytesval", _TestUtil.randomRealisticUnicodeString(random()), StringField.TYPE_UNSTORED));
- document.add(new DoubleField("double", random().nextDouble()));
+ document.add(newTextField("english", English.intToEnglish(i), Field.Store.NO));
+ document.add(newTextField("oddeven", (i % 2 == 0) ? "even" : "odd", Field.Store.NO));
+ document.add(newStringField("byte", "" + ((byte) random().nextInt()), Field.Store.NO));
+ document.add(newStringField("short", "" + ((short) random().nextInt()), Field.Store.NO));
+ document.add(new IntField("int", random().nextInt(), Field.Store.NO));
+ document.add(new LongField("long", random().nextLong(), Field.Store.NO));
+
+ document.add(new FloatField("float", random().nextFloat(), Field.Store.NO));
+ document.add(new DoubleField("double", random().nextDouble(), Field.Store.NO));
+ document.add(newStringField("bytes", _TestUtil.randomRealisticUnicodeString(random()), Field.Store.NO));
+ document.add(newStringField("bytesval", _TestUtil.randomRealisticUnicodeString(random()), Field.Store.NO));
+ document.add(new DoubleField("double", random().nextDouble(), Field.Store.NO));
if (supportsDocValues) {
document.add(new IntDocValuesField("intdocvalues", random().nextInt()));
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSearchWithThreads.java Sun Jun 10 18:27:08 2012
@@ -22,14 +22,12 @@ import java.util.concurrent.atomic.Atomi
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util._TestUtil;
@SuppressCodecs({ "SimpleText", "Memory" })
public class TestSearchWithThreads extends LuceneTestCase {
@@ -53,7 +51,7 @@ public class TestSearchWithThreads exten
// TODO: replace w/ the @nightly test data; make this
// into an optional @nightly stress test
final Document doc = new Document();
- final Field body = newField("body", "", TextField.TYPE_UNSTORED);
+ final Field body = newTextField("body", "", Field.Store.NO);
doc.add(body);
final StringBuilder sb = new StringBuilder();
for(int docCount=0;docCount<NUM_DOCS;docCount++) {
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarity.java Sun Jun 10 18:27:08 2012
@@ -17,6 +17,7 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import org.apache.lucene.document.Field;
import org.apache.lucene.util.LuceneTestCase;
import java.io.IOException;
@@ -28,11 +29,9 @@ import org.apache.lucene.index.Norm;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.similarities.DefaultSimilarity;
-import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
/** Similarity unit test.
*
@@ -59,10 +58,10 @@ public class TestSimilarity extends Luce
.setSimilarity(new SimpleSimilarity()));
Document d1 = new Document();
- d1.add(newField("field", "a c", TextField.TYPE_STORED));
+ d1.add(newTextField("field", "a c", Field.Store.YES));
Document d2 = new Document();
- d2.add(newField("field", "a b c", TextField.TYPE_STORED));
+ d2.add(newTextField("field", "a b c", Field.Store.YES));
writer.addDocument(d1);
writer.addDocument(d2);
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarityProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarityProvider.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarityProvider.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSimilarityProvider.java Sun Jun 10 18:27:08 2012
@@ -20,7 +20,6 @@ package org.apache.lucene.search;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig;
@@ -49,9 +48,9 @@ public class TestSimilarityProvider exte
new MockAnalyzer(random())).setSimilarity(sim);
RandomIndexWriter iw = new RandomIndexWriter(random(), directory, iwc);
Document doc = new Document();
- Field field = newField("foo", "", TextField.TYPE_UNSTORED);
+ Field field = newTextField("foo", "", Field.Store.NO);
doc.add(field);
- Field field2 = newField("bar", "", TextField.TYPE_UNSTORED);
+ Field field2 = newTextField("bar", "", Field.Store.NO);
doc.add(field2);
field.setStringValue("quick brown fox");
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java Sun Jun 10 18:27:08 2012
@@ -159,7 +159,7 @@ public class TestSloppyPhraseQuery exten
private static Document makeDocument(String docText) {
Document doc = new Document();
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
customType.setOmitNorms(true);
Field f = new Field("f", docText, customType);
doc.add(f);
@@ -234,7 +234,7 @@ public class TestSloppyPhraseQuery exten
public void testSlopWithHoles() throws Exception {
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
- FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);
customType.setOmitNorms(true);
Field f = new Field("lyrics", "", customType);
Document doc = new Document();
@@ -272,7 +272,7 @@ public class TestSloppyPhraseQuery exten
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- doc.add(newField("lyrics", document, new FieldType(TextField.TYPE_UNSTORED)));
+ doc.add(newField("lyrics", document, new FieldType(TextField.TYPE_NOT_STORED)));
iw.addDocument(doc);
IndexReader ir = iw.getReader();
iw.close();
@@ -325,7 +325,7 @@ public class TestSloppyPhraseQuery exten
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- doc.add(newField("lyrics", document, new FieldType(TextField.TYPE_UNSTORED)));
+ doc.add(newField("lyrics", document, new FieldType(TextField.TYPE_NOT_STORED)));
iw.addDocument(doc);
IndexReader ir = iw.getReader();
iw.close();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java Sun Jun 10 18:27:08 2012
@@ -155,21 +155,21 @@ public class TestSort extends LuceneTest
if (((i%2)==0 && even) || ((i%2)==1 && odd)) {
Document doc = new Document();
doc.add (new Field ("tracer", data[i][0], ft1));
- doc.add (new TextField ("contents", data[i][1]));
+ doc.add (new TextField ("contents", data[i][1], Field.Store.NO));
if (data[i][2] != null) {
- doc.add(new StringField ("int", data[i][2]));
+ doc.add(new StringField ("int", data[i][2], Field.Store.NO));
if (supportsDocValues) {
doc.add(new PackedLongDocValuesField("int", Integer.parseInt(data[i][2])));
}
}
if (data[i][3] != null) {
- doc.add(new StringField ("float", data[i][3]));
+ doc.add(new StringField ("float", data[i][3], Field.Store.NO));
if (supportsDocValues) {
doc.add(new FloatDocValuesField("float", Float.parseFloat(data[i][3])));
}
}
if (data[i][4] != null) {
- doc.add(new StringField ("string", data[i][4]));
+ doc.add(new StringField ("string", data[i][4], Field.Store.NO));
if (supportsDocValues) {
switch(stringDVType) {
case BYTES_FIXED_SORTED:
@@ -195,18 +195,18 @@ public class TestSort extends LuceneTest
}
}
}
- if (data[i][5] != null) doc.add (new StringField ("custom", data[i][5]));
- if (data[i][6] != null) doc.add (new StringField ("i18n", data[i][6]));
- if (data[i][7] != null) doc.add (new StringField ("long", data[i][7]));
+ if (data[i][5] != null) doc.add (new StringField ("custom", data[i][5], Field.Store.NO));
+ if (data[i][6] != null) doc.add (new StringField ("i18n", data[i][6], Field.Store.NO));
+ if (data[i][7] != null) doc.add (new StringField ("long", data[i][7], Field.Store.NO));
if (data[i][8] != null) {
- doc.add(new StringField ("double", data[i][8]));
+ doc.add(new StringField ("double", data[i][8], Field.Store.NO));
if (supportsDocValues) {
doc.add(new DoubleDocValuesField("double", Double.parseDouble(data[i][8])));
}
}
- if (data[i][9] != null) doc.add (new StringField ("short", data[i][9]));
- if (data[i][10] != null) doc.add (new StringField ("byte", data[i][10]));
- if (data[i][11] != null) doc.add (new StringField ("parser", data[i][11]));
+ if (data[i][9] != null) doc.add (new StringField ("short", data[i][9], Field.Store.NO));
+ if (data[i][10] != null) doc.add (new StringField ("byte", data[i][10], Field.Store.NO));
+ if (data[i][11] != null) doc.add (new StringField ("parser", data[i][11], Field.Store.NO));
for(IndexableField f : doc.getFields()) {
if (!f.fieldType().omitNorms()) {
@@ -245,12 +245,12 @@ public class TestSort extends LuceneTest
String num = getRandomCharString(getRandomNumber(2, 8), 48, 52);
doc.add (new Field ("tracer", num, onlyStored));
//doc.add (new Field ("contents", Integer.toString(i), Field.Store.NO, Field.Index.ANALYZED));
- doc.add(new StringField("string", num));
+ doc.add(new StringField("string", num, Field.Store.NO));
if (supportsDocValues) {
doc.add(new SortedBytesDocValuesField("string", new BytesRef(num)));
}
String num2 = getRandomCharString(getRandomNumber(1, 4), 48, 50);
- doc.add(new StringField ("string2", num2));
+ doc.add(new StringField ("string2", num2, Field.Store.NO));
if (supportsDocValues) {
doc.add(new SortedBytesDocValuesField("string2", new BytesRef(num2)));
}
@@ -264,12 +264,12 @@ public class TestSort extends LuceneTest
String numFixed = getRandomCharString(fixedLen, 48, 52);
doc.add (new Field ("fixed_tracer", numFixed, onlyStored));
//doc.add (new Field ("contents", Integer.toString(i), Field.Store.NO, Field.Index.ANALYZED));
- doc.add(new StringField("string_fixed", numFixed));
+ doc.add(new StringField("string_fixed", numFixed, Field.Store.NO));
if (supportsDocValues) {
doc.add(new SortedBytesDocValuesField("string_fixed", new BytesRef(numFixed), true));
}
String num2Fixed = getRandomCharString(fixedLen2, 48, 52);
- doc.add(new StringField ("string2_fixed", num2Fixed));
+ doc.add(new StringField ("string2_fixed", num2Fixed, Field.Store.NO));
if (supportsDocValues) {
doc.add(new SortedBytesDocValuesField("string2_fixed", new BytesRef(num2Fixed), true));
}
@@ -1274,12 +1274,12 @@ public class TestSort extends LuceneTest
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random())));
Document doc = new Document();
- doc.add(newField("f", "", StringField.TYPE_UNSTORED));
- doc.add(newField("t", "1", StringField.TYPE_UNSTORED));
+ doc.add(newStringField("f", "", Field.Store.NO));
+ doc.add(newStringField("t", "1", Field.Store.NO));
w.addDocument(doc);
w.commit();
doc = new Document();
- doc.add(newField("t", "1", StringField.TYPE_UNSTORED));
+ doc.add(newStringField("t", "1", Field.Store.NO));
w.addDocument(doc);
IndexReader r = DirectoryReader.open(w, true);
@@ -1300,8 +1300,8 @@ public class TestSort extends LuceneTest
TEST_VERSION_CURRENT, new MockAnalyzer(random())));
for (int i=0; i<5; i++) {
Document doc = new Document();
- doc.add (new StringField ("string", "a"+i));
- doc.add (new StringField ("string", "b"+i));
+ doc.add (new StringField ("string", "a"+i, Field.Store.NO));
+ doc.add (new StringField ("string", "b"+i, Field.Store.NO));
writer.addDocument (doc);
}
writer.forceMerge(1); // enforce one segment to have a higher unique term count in all cases
@@ -1322,8 +1322,8 @@ public class TestSort extends LuceneTest
RandomIndexWriter writer = new RandomIndexWriter(random(), indexStore);
for (int i=0; i<5; i++) {
Document doc = new Document();
- doc.add (new StringField ("string", "a"+i));
- doc.add (new StringField ("string", "b"+i));
+ doc.add (new StringField ("string", "a"+i, Field.Store.NO));
+ doc.add (new StringField ("string", "b"+i, Field.Store.NO));
writer.addDocument (doc);
}
IndexReader reader = writer.getReader();
@@ -1408,7 +1408,7 @@ public class TestSort extends LuceneTest
final Document doc = new Document();
doc.add(new SortedBytesDocValuesField("stringdv", br));
- doc.add(newField("string", s, StringField.TYPE_UNSTORED));
+ doc.add(newStringField("string", s, Field.Store.NO));
doc.add(new PackedLongDocValuesField("id", numDocs));
docValues.add(br);
writer.addDocument(doc);
@@ -1497,13 +1497,13 @@ public class TestSort extends LuceneTest
for(int seg=0;seg<2;seg++) {
for(int docIDX=0;docIDX<10;docIDX++) {
Document doc = new Document();
- doc.add(newField("id", ""+docIDX, StringField.TYPE_STORED));
+ doc.add(newStringField("id", ""+docIDX, Field.Store.YES));
StringBuilder sb = new StringBuilder();
for(int i=0;i<id;i++) {
sb.append(' ');
sb.append("text");
}
- doc.add(newField("body", sb.toString(), TextField.TYPE_UNSTORED));
+ doc.add(newTextField("body", sb.toString(), Field.Store.NO));
w.addDocument(doc);
id++;
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSubScorerFreqs.java Sun Jun 10 18:27:08 2012
@@ -45,11 +45,11 @@ public class TestSubScorerFreqs extends
int num = atLeast(31);
for (int i = 0; i < num; i++) {
Document doc = new Document();
- doc.add(newField("f", "a b c d b c d c d d", TextField.TYPE_UNSTORED));
+ doc.add(newTextField("f", "a b c d b c d c d d", Field.Store.NO));
w.addDocument(doc);
doc = new Document();
- doc.add(newField("f", "a b c d", TextField.TYPE_UNSTORED));
+ doc.add(newTextField("f", "a b c d", Field.Store.NO));
w.addDocument(doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermRangeQuery.java Sun Jun 10 18:27:08 2012
@@ -24,8 +24,7 @@ import java.util.Set;
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@@ -263,8 +262,8 @@ public class TestTermRangeQuery extends
private void insertDoc(IndexWriter writer, String content) throws IOException {
Document doc = new Document();
- doc.add(newField("id", "id" + docCount, StringField.TYPE_STORED));
- doc.add(newField("content", content, TextField.TYPE_UNSTORED));
+ doc.add(newStringField("id", "id" + docCount, Field.Store.YES));
+ doc.add(newTextField("content", content, Field.Store.NO));
writer.addDocument(doc);
docCount++;
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermScorer.java Sun Jun 10 18:27:08 2012
@@ -23,7 +23,7 @@ import java.util.List;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -54,7 +54,7 @@ public class TestTermScorer extends Luce
for (int i = 0; i < values.length; i++) {
Document doc = new Document();
doc
- .add(newField(FIELD, values[i], TextField.TYPE_STORED));
+ .add(newTextField(FIELD, values[i], Field.Store.YES));
writer.addDocument(doc);
}
indexReader = SlowCompositeReaderWrapper.wrap(writer.getReader());
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermVectors.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermVectors.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermVectors.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTermVectors.java Sun Jun 10 18:27:08 2012
@@ -69,7 +69,7 @@ public class TestTermVectors extends Luc
}
doc.add(new Field("field", English.intToEnglish(i), ft));
//test no term vectors too
- doc.add(new Field("noTV", English.intToEnglish(i), TextField.TYPE_STORED));
+ doc.add(new TextField("noTV", English.intToEnglish(i), Field.Store.YES));
writer.addDocument(doc);
}
reader = writer.getReader();
@@ -341,7 +341,7 @@ public class TestTermVectors extends Luc
}
for (int i = 0; i < 100; i++) {
Document doc = new Document();
- doc.add(newField("field", English.intToEnglish(i), TextField.TYPE_STORED));
+ doc.add(newTextField("field", English.intToEnglish(i), Field.Store.YES));
writer.addDocument(doc);
}
if (VERBOSE) {
@@ -401,7 +401,7 @@ public class TestTermVectors extends Luc
ft5.setStoreTermVectorOffsets(true);
ft5.setStoreTermVectorPositions(true);
- doc.add(newField("field", "one", TextField.TYPE_STORED));
+ doc.add(newTextField("field", "one", Field.Store.YES));
doc.add(newField("field", "one", ft2));
doc.add(newField("field", "one", ft3));
doc.add(newField("field", "one", ft4));
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java Sun Jun 10 18:27:08 2012
@@ -22,7 +22,7 @@ import java.util.BitSet;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -116,7 +116,7 @@ public class TestTimeLimitingCollector e
private void add(String value, RandomIndexWriter iw) throws IOException {
Document d = new Document();
- d.add(newField(FIELD_NAME, value, TextField.TYPE_UNSTORED));
+ d.add(newTextField(FIELD_NAME, value, Field.Store.NO));
iw.addDocument(d);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopDocsMerge.java Sun Jun 10 18:27:08 2012
@@ -22,10 +22,9 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.FloatField;
import org.apache.lucene.document.IntField;
-import org.apache.lucene.document.StringField;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.CompositeReaderContext;
import org.apache.lucene.index.IndexReader;
@@ -95,9 +94,9 @@ public class TestTopDocsMerge extends Lu
for(int docIDX=0;docIDX<numDocs;docIDX++) {
final Document doc = new Document();
- 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 FloatField("float", random().nextFloat()));
+ doc.add(newStringField("string", _TestUtil.randomRealisticUnicodeString(random()), Field.Store.NO));
+ doc.add(newTextField("text", content[random().nextInt(content.length)], Field.Store.NO));
+ doc.add(new FloatField("float", random().nextFloat(), Field.Store.NO));
final int intValue;
if (random().nextInt(100) == 17) {
intValue = Integer.MIN_VALUE;
@@ -106,7 +105,7 @@ public class TestTopDocsMerge extends Lu
} else {
intValue = random().nextInt();
}
- doc.add(new IntField("int", intValue));
+ doc.add(new IntField("int", intValue, Field.Store.NO));
if (VERBOSE) {
System.out.println(" doc=" + doc);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcard.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcard.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcard.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcard.java Sun Jun 10 18:27:08 2012
@@ -17,11 +17,11 @@ package org.apache.lucene.search;
* limitations under the License.
*/
+import org.apache.lucene.document.Field;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiFields;
@@ -250,7 +250,7 @@ public class TestWildcard
RandomIndexWriter writer = new RandomIndexWriter(random(), indexStore);
for (int i = 0; i < contents.length; ++i) {
Document doc = new Document();
- doc.add(newField(field, contents[i], TextField.TYPE_STORED));
+ doc.add(newTextField(field, contents[i], Field.Store.YES));
writer.addDocument(doc);
}
writer.close();
@@ -350,7 +350,7 @@ public class TestWildcard
.setMergePolicy(newLogMergePolicy()));
for (int i = 0; i < docs.length; i++) {
Document doc = new Document();
- doc.add(newField(field,docs[i],TextField.TYPE_UNSTORED));
+ doc.add(newTextField(field, docs[i], Field.Store.NO));
iw.addDocument(doc);
}
iw.close();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestWildcardRandom.java Sun Jun 10 18:27:08 2012
@@ -25,7 +25,6 @@ import java.util.Locale;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -52,7 +51,7 @@ public class TestWildcardRandom extends
.setMaxBufferedDocs(_TestUtil.nextInt(random(), 50, 1000)));
Document doc = new Document();
- Field field = newField("field", "", StringField.TYPE_UNSTORED);
+ Field field = newStringField("field", "", Field.Store.NO);
doc.add(field);
NumberFormat df = new DecimalFormat("000", new DecimalFormatSymbols(Locale.ENGLISH));
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/PayloadHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/PayloadHelper.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/PayloadHelper.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/PayloadHelper.java Sun Jun 10 18:27:08 2012
@@ -126,9 +126,9 @@ public class PayloadHelper {
// writer.infoStream = System.out;
for (int i = 0; i < numDocs; i++) {
Document doc = new Document();
- doc.add(new Field(FIELD, English.intToEnglish(i), TextField.TYPE_STORED));
- doc.add(new Field(MULTI_FIELD, English.intToEnglish(i) + " " + English.intToEnglish(i), TextField.TYPE_STORED));
- doc.add(new Field(NO_PAYLOAD_FIELD, English.intToEnglish(i), TextField.TYPE_STORED));
+ doc.add(new TextField(FIELD, English.intToEnglish(i), Field.Store.YES));
+ doc.add(new TextField(MULTI_FIELD, English.intToEnglish(i) + " " + English.intToEnglish(i), Field.Store.YES));
+ doc.add(new TextField(NO_PAYLOAD_FIELD, English.intToEnglish(i), Field.Store.YES));
writer.addDocument(doc);
}
reader = DirectoryReader.open(writer, true);
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java Sun Jun 10 18:27:08 2012
@@ -21,7 +21,7 @@ import java.io.Reader;
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Norm;
@@ -35,7 +35,6 @@ import org.apache.lucene.search.IndexSea
import org.apache.lucene.search.TermStatistics;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.similarities.DefaultSimilarity;
-import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.search.spans.SpanQuery;
import org.apache.lucene.search.spans.SpanNearQuery;
import org.apache.lucene.search.spans.SpanTermQuery;
@@ -114,9 +113,9 @@ public class TestPayloadNearQuery extend
//writer.infoStream = System.out;
for (int i = 0; i < 1000; i++) {
Document doc = new Document();
- doc.add(newField("field", English.intToEnglish(i), TextField.TYPE_STORED));
+ doc.add(newTextField("field", English.intToEnglish(i), Field.Store.YES));
String txt = English.intToEnglish(i) +' '+English.intToEnglish(i+1);
- doc.add(newField("field2", txt, TextField.TYPE_STORED));
+ doc.add(newTextField("field2", txt, Field.Store.YES));
writer.addDocument(doc);
}
reader = writer.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java Sun Jun 10 18:27:08 2012
@@ -44,7 +44,6 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.Field;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.apache.lucene.document.TextField;
import java.io.Reader;
import java.io.IOException;
@@ -124,11 +123,11 @@ public class TestPayloadTermQuery extend
//writer.infoStream = System.out;
for (int i = 0; i < 1000; i++) {
Document doc = new Document();
- Field noPayloadField = newField(PayloadHelper.NO_PAYLOAD_FIELD, English.intToEnglish(i), TextField.TYPE_STORED);
+ Field noPayloadField = newTextField(PayloadHelper.NO_PAYLOAD_FIELD, English.intToEnglish(i), Field.Store.YES);
//noPayloadField.setBoost(0);
doc.add(noPayloadField);
- doc.add(newField("field", English.intToEnglish(i), TextField.TYPE_STORED));
- doc.add(newField("multiField", English.intToEnglish(i) + " " + English.intToEnglish(i), TextField.TYPE_STORED));
+ doc.add(newTextField("field", English.intToEnglish(i), Field.Store.YES));
+ doc.add(newTextField("multiField", English.intToEnglish(i) + " " + English.intToEnglish(i), Field.Store.YES));
writer.addDocument(doc);
}
reader = writer.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java Sun Jun 10 18:27:08 2012
@@ -17,26 +17,21 @@ package org.apache.lucene.search.similar
* limitations under the License.
*/
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-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.TextField;
import org.apache.lucene.index.FieldInfo.IndexOptions;
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
-import org.apache.lucene.search.Collector;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
-import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.search.spans.SpanOrQuery;
@@ -99,7 +94,7 @@ public class TestSimilarity2 extends Luc
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- doc.add(newField("foo", "bar", TextField.TYPE_UNSTORED));
+ doc.add(newTextField("foo", "bar", Field.Store.NO));
iw.addDocument(doc);
IndexReader ir = iw.getReader();
iw.close();
@@ -121,7 +116,7 @@ public class TestSimilarity2 extends Luc
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- doc.add(newField("foo", "bar", TextField.TYPE_UNSTORED));
+ doc.add(newTextField("foo", "bar", Field.Store.NO));
iw.addDocument(doc);
IndexReader ir = iw.getReader();
iw.close();
@@ -143,7 +138,7 @@ public class TestSimilarity2 extends Luc
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- FieldType ft = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
ft.setOmitNorms(true);
ft.freeze();
doc.add(newField("foo", "bar", ft));
@@ -167,7 +162,7 @@ public class TestSimilarity2 extends Luc
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- FieldType ft = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
ft.setIndexOptions(IndexOptions.DOCS_ONLY);
ft.freeze();
Field f = newField("foo", "bar", ft);
@@ -192,7 +187,7 @@ public class TestSimilarity2 extends Luc
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- FieldType ft = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
ft.setIndexOptions(IndexOptions.DOCS_ONLY);
ft.setOmitNorms(true);
ft.freeze();
@@ -222,7 +217,7 @@ public class TestSimilarity2 extends Luc
Directory dir = newDirectory();
RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
Document doc = new Document();
- FieldType ft = new FieldType(TextField.TYPE_UNSTORED);
+ FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
doc.add(newField("foo", "bar", ft));
iw.addDocument(doc);
IndexReader ir = iw.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java Sun Jun 10 18:27:08 2012
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
@@ -112,7 +113,7 @@ public class TestSimilarityBase extends
FieldType ft = new FieldType(TextField.TYPE_STORED);
ft.setIndexed(false);
d.add(newField(FIELD_ID, Integer.toString(i), ft));
- d.add(newField(FIELD_BODY, docs[i], TextField.TYPE_STORED));
+ d.add(newTextField(FIELD_BODY, docs[i], Field.Store.YES));
writer.addDocument(d);
}
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestBasics.java Sun Jun 10 18:27:08 2012
@@ -28,7 +28,7 @@ import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.TextField;
+import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -115,7 +115,7 @@ public class TestBasics extends LuceneTe
//writer.infoStream = System.out;
for (int i = 0; i < 2000; i++) {
Document doc = new Document();
- doc.add(newField("field", English.intToEnglish(i), TextField.TYPE_STORED));
+ doc.add(newTextField("field", English.intToEnglish(i), Field.Store.YES));
writer.addDocument(doc);
}
reader = writer.getReader();
Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java?rev=1348639&r1=1348638&r2=1348639&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java Sun Jun 10 18:27:08 2012
@@ -23,7 +23,6 @@ import java.util.Set;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -48,7 +47,7 @@ public class TestFieldMaskingSpanQuery e
}
protected static Field field(String name, String value) {
- return newField(name, value, TextField.TYPE_UNSTORED);
+ return newTextField(name, value, Field.Store.NO);
}
protected static IndexSearcher searcher;