You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/08/16 00:03:52 UTC
svn commit: r1158029 [10/15] - in /lucene/dev/branches/fieldtype_conflicted:
lucene/ lucene/contrib/ lucene/contrib/demo/src/java/org/apache/lucene/demo/
lucene/contrib/highlighter/src/java/org/apache/lucene/search/highlight/
lucene/contrib/highlighter...
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermVectorsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermVectorsWriter.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermVectorsWriter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermVectorsWriter.java Mon Aug 15 22:03:41 2011
@@ -28,6 +28,9 @@ import org.apache.lucene.analysis.MockTo
import org.apache.lucene.analysis.TokenStream;
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.store.MockDirectoryWrapper;
import org.apache.lucene.store.RAMDirectory;
@@ -41,10 +44,14 @@ public class TestTermVectorsWriter exten
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document doc = new Document();
- Field f = newField("field", "abcd", Field.Store.NO, Field.Index.NOT_ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
+ Field f = newField("field", "abcd", customType);
doc.add(f);
doc.add(f);
- Field f2 = newField("field", "", Field.Store.NO, Field.Index.NOT_ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ Field f2 = newField("field", "", customType);
doc.add(f2);
doc.add(f);
w.addDocument(doc);
@@ -76,7 +83,11 @@ public class TestTermVectorsWriter exten
Directory dir = newDirectory();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document doc = new Document();
- Field f = newField("field", "abcd", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
+ Field f = newField("field", "abcd", customType);
doc.add(f);
doc.add(f);
w.addDocument(doc);
@@ -98,7 +109,11 @@ public class TestTermVectorsWriter exten
Directory dir = newDirectory();
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document doc = new Document();
- Field f = newField("field", "abcd ", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
+ Field f = newField("field", "abcd ", customType);
doc.add(f);
doc.add(f);
w.addDocument(doc);
@@ -124,7 +139,11 @@ public class TestTermVectorsWriter exten
TokenStream stream = analyzer.tokenStream("field", new StringReader("abcd "));
stream.reset(); // TODO: wierd to reset before wrapping with CachingTokenFilter... correct?
stream = new CachingTokenFilter(stream);
- Field f = new Field("field", stream, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
+ Field f = new Field("field", customType, stream);
doc.add(f);
doc.add(f);
w.addDocument(doc);
@@ -147,7 +166,11 @@ public class TestTermVectorsWriter exten
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.SIMPLE, true, MockTokenFilter.ENGLISH_STOPSET, true)));
Document doc = new Document();
- Field f = newField("field", "abcd the", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
+ Field f = newField("field", "abcd the", customType);
doc.add(f);
doc.add(f);
w.addDocument(doc);
@@ -170,10 +193,12 @@ public class TestTermVectorsWriter exten
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document doc = new Document();
- Field f = newField("field", "abcd the ", Field.Store.NO,
- Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
- Field f2 = newField("field", "crunch man", Field.Store.NO,
- Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
+ Field f = newField("field", "abcd the ", customType);
+ Field f2 = newField("field", "crunch man", customType);
doc.add(f);
doc.add(f2);
w.addDocument(doc);
@@ -201,10 +226,12 @@ public class TestTermVectorsWriter exten
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document doc = new Document();
- Field f = newField("field", "", Field.Store.NO,
- Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
- Field f2 = newField("field", "crunch man", Field.Store.NO,
- Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
+ Field f = newField("field", "", customType);
+ Field f2 = newField("field", "crunch man", customType);
doc.add(f);
doc.add(f2);
w.addDocument(doc);
@@ -229,14 +256,16 @@ public class TestTermVectorsWriter exten
IndexWriter w = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document doc = new Document();
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ customType.setStoreTermVectorPositions(true);
+ customType.setStoreTermVectorOffsets(true);
- Field f = newField("field", "abcd", Field.Store.NO,
- Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ Field f = newField("field", "abcd", customType);
doc.add(f);
- doc.add(newField("field", "", Field.Store.NO, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.add(newField("field", "", customType));
- Field f2 = newField("field", "crunch", Field.Store.NO,
- Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS);
+ Field f2 = newField("field", "crunch", customType);
doc.add(f2);
w.addDocument(doc);
@@ -268,18 +297,21 @@ public class TestTermVectorsWriter exten
new LogDocMergePolicy()));
Document document = new Document();
+ FieldType customType = new FieldType();
+ customType.setStored(true);
- Field storedField = newField("stored", "stored", Field.Store.YES,
- Field.Index.NO);
+ Field storedField = newField("stored", "stored", customType);
document.add(storedField);
writer.addDocument(document);
writer.addDocument(document);
document = new Document();
document.add(storedField);
- Field termVectorField = newField("termVector", "termVector",
- Field.Store.NO, Field.Index.NOT_ANALYZED,
- Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType2 = new FieldType(StringField.TYPE_UNSTORED);
+ customType2.setStoreTermVectors(true);
+ customType2.setStoreTermVectorPositions(true);
+ customType2.setStoreTermVectorOffsets(true);
+ Field termVectorField = newField("termVector", "termVector", customType2);
document.add(termVectorField);
writer.addDocument(document);
@@ -320,17 +352,21 @@ public class TestTermVectorsWriter exten
Document document = new Document();
- Field storedField = newField("stored", "stored", Field.Store.YES,
- Field.Index.NO);
+ FieldType customType = new FieldType();
+ customType.setStored(true);
+
+ Field storedField = newField("stored", "stored", customType);
document.add(storedField);
writer.addDocument(document);
writer.addDocument(document);
document = new Document();
document.add(storedField);
- Field termVectorField = newField("termVector", "termVector",
- Field.Store.NO, Field.Index.NOT_ANALYZED,
- Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType2 = new FieldType(StringField.TYPE_UNSTORED);
+ customType2.setStoreTermVectors(true);
+ customType2.setStoreTermVectorPositions(true);
+ customType2.setStoreTermVectorOffsets(true);
+ Field termVectorField = newField("termVector", "termVector", customType2);
document.add(termVectorField);
writer.addDocument(document);
writer.optimize();
@@ -357,12 +393,16 @@ public class TestTermVectorsWriter exten
Document document = new Document();
document = new Document();
- Field storedField = newField("stored", "stored", Field.Store.YES,
- Field.Index.NO);
+ FieldType customType = new FieldType();
+ customType.setStored(true);
+
+ Field storedField = newField("stored", "stored", customType);
document.add(storedField);
- Field termVectorField = newField("termVector", "termVector",
- Field.Store.NO, Field.Index.NOT_ANALYZED,
- Field.TermVector.WITH_POSITIONS_OFFSETS);
+ FieldType customType2 = new FieldType(StringField.TYPE_UNSTORED);
+ customType2.setStoreTermVectors(true);
+ customType2.setStoreTermVectorPositions(true);
+ customType2.setStoreTermVectorOffsets(true);
+ Field termVectorField = newField("termVector", "termVector", customType2);
document.add(termVectorField);
for(int i=0;i<10;i++)
writer.addDocument(document);
@@ -394,18 +434,22 @@ public class TestTermVectorsWriter exten
IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document document = new Document();
- document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED,
- Field.TermVector.YES));
+ FieldType customType2 = new FieldType(StringField.TYPE_UNSTORED);
+ customType2.setStoreTermVectors(true);
+ customType2.setStoreTermVectorPositions(true);
+ customType2.setStoreTermVectorOffsets(true);
+ document.add(newField("tvtest", "a b c", customType2));
iw.addDocument(document);
document = new Document();
- document.add(newField("tvtest", "x y z", Field.Store.NO, Field.Index.ANALYZED,
- Field.TermVector.NO));
+ document.add(newField("tvtest", "x y z", TextField.TYPE_UNSTORED));
iw.addDocument(document);
// Make first segment
iw.commit();
- document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED,
- Field.TermVector.YES));
+ FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ Field termVectorField = newField("termVector", "termVector", customType2);
+ document.add(newField("tvtest", "a b c", customType));
iw.addDocument(document);
// Make 2nd segment
iw.commit();
@@ -421,22 +465,24 @@ public class TestTermVectorsWriter exten
IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)));
Document document = new Document();
- document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED,
- Field.TermVector.YES));
+ FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
+ Field termVectorField = newField("termVector", "termVector", customType);
+ document.add(newField("tvtest", "a b c", customType));
iw.addDocument(document);
iw.commit();
document = new Document();
- document.add(newField("tvtest", "x y z", Field.Store.NO, Field.Index.ANALYZED,
- Field.TermVector.NO));
+ document.add(newField("tvtest", "x y z", TextField.TYPE_UNSTORED));
iw.addDocument(document);
// Make first segment
iw.commit();
iw.optimize();
- document.add(newField("tvtest", "a b c", Field.Store.NO, Field.Index.ANALYZED,
- Field.TermVector.YES));
+ FieldType customType2 = new FieldType(StringField.TYPE_UNSTORED);
+ customType2.setStoreTermVectors(true);
+ document.add(newField("tvtest", "a b c", customType2));
iw.addDocument(document);
// Make 2nd segment
iw.commit();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java Mon Aug 15 22:03:41 2011
@@ -25,7 +25,7 @@ import org.apache.lucene.analysis.Analyz
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
@@ -69,7 +69,8 @@ public class TestTermdocPerf extends Luc
};
Document doc = new Document();
- doc.add(newField(field,val, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
+
+ doc.add(newField(field,val, StringField.TYPE_UNSTORED));
IndexWriter writer = new IndexWriter(
dir,
newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer).
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestThreadedOptimize.java Mon Aug 15 22:03:41 2011
@@ -22,7 +22,8 @@ import org.apache.lucene.analysis.Analyz
import org.apache.lucene.analysis.MockTokenizer;
import org.apache.lucene.store.Directory;
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.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.util.English;
@@ -62,10 +63,14 @@ public class TestThreadedOptimize extend
((LogMergePolicy) writer.getConfig().getMergePolicy()).setMergeFactor(1000);
+ final FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
+ customType.setStored(true);
+ customType.setOmitNorms(true);
+
for(int i=0;i<200;i++) {
Document d = new Document();
- d.add(newField("id", Integer.toString(i), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
- d.add(newField("contents", English.intToEnglish(i), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));
+ d.add(newField("id", Integer.toString(i), customType));
+ d.add(newField("contents", English.intToEnglish(i), customType));
writer.addDocument(d);
}
@@ -85,8 +90,8 @@ public class TestThreadedOptimize extend
writerFinal.optimize(false);
for(int k=0;k<17*(1+iFinal);k++) {
Document d = new Document();
- d.add(newField("id", iterFinal + "_" + iFinal + "_" + j + "_" + k, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
- d.add(newField("contents", English.intToEnglish(iFinal+k), Field.Store.NO, Field.Index.ANALYZED_NO_NORMS));
+ d.add(newField("id", iterFinal + "_" + iFinal + "_" + j + "_" + k, customType));
+ d.add(newField("contents", English.intToEnglish(iFinal+k), customType));
writerFinal.addDocument(d);
}
for(int k=0;k<9*(1+iFinal);k++)
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTieredMergePolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTieredMergePolicy.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTieredMergePolicy.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTieredMergePolicy.java Mon Aug 15 22:03:41 2011
@@ -19,7 +19,7 @@ package org.apache.lucene.index;
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.store.Directory;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util._TestUtil;
@@ -39,7 +39,7 @@ public class TestTieredMergePolicy exten
w.setInfoStream(VERBOSE ? System.out : null);
for(int i=0;i<80;i++) {
Document doc = new Document();
- doc.add(newField("content", "aaa " + (i%4), Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(newField("content", "aaa " + (i%4), TextField.TYPE_UNSTORED));
w.addDocument(doc);
}
assertEquals(80, w.maxDoc());
@@ -86,7 +86,7 @@ public class TestTieredMergePolicy exten
final int numDocs = _TestUtil.nextInt(random, 20, 100);
for(int i=0;i<numDocs;i++) {
Document doc = new Document();
- doc.add(newField("content", "aaa " + (i%4), Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(newField("content", "aaa " + (i%4), TextField.TYPE_UNSTORED));
w.addDocument(doc);
int count = w.getSegmentCount();
maxCount = Math.max(count, maxCount);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactionRollback.java Mon Aug 15 22:03:41 2011
@@ -29,7 +29,8 @@ import java.util.HashMap;
import org.apache.lucene.util.LuceneTestCase;
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.store.Directory;
import org.apache.lucene.util.Bits;
@@ -128,9 +129,12 @@ public class TestTransactionRollback ext
//Build index, of records 1 to 100, committing after each batch of 10
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,Field.Store.YES,Field.Index.ANALYZED));
+ doc.add(newField(FIELD_RECORD_ID,""+currentRecordId,customType));
w.addDocument(doc);
if (currentRecordId%10 == 0) {
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactions.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactions.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestTransactions.java Mon Aug 15 22:03:41 2011
@@ -21,7 +21,9 @@ 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.store.Directory;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.store.RAMDirectory;
@@ -145,11 +147,13 @@ public class TestTransactions extends Lu
public void update(IndexWriter writer) throws IOException {
// Add 10 docs:
+ FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
+ customType.setStoreTermVectors(true);
for(int j=0; j<10; j++) {
Document d = new Document();
int n = random.nextInt();
- d.add(newField("id", Integer.toString(nextID++), Field.Store.YES, Field.Index.NOT_ANALYZED));
- d.add(newField("contents", English.intToEnglish(n), Field.Store.NO, Field.Index.ANALYZED));
+ d.add(newField("id", Integer.toString(nextID++), customType));
+ d.add(newField("contents", English.intToEnglish(n), TextField.TYPE_UNSTORED));
writer.addDocument(d);
}
@@ -193,7 +197,7 @@ public class TestTransactions extends Lu
for(int j=0; j<7; j++) {
Document d = new Document();
int n = random.nextInt();
- d.add(newField("contents", English.intToEnglish(n), Field.Store.NO, Field.Index.ANALYZED));
+ d.add(newField("contents", English.intToEnglish(n), TextField.TYPE_UNSTORED));
writer.addDocument(d);
}
writer.close();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/codecs/preflex/TestSurrogates.java Mon Aug 15 22:03:41 2011
@@ -303,7 +303,9 @@ public class TestSurrogates extends Luce
uniqueTerms.add(term);
fieldTerms.add(new Term(field, term));
Document doc = new Document();
- doc.add(newField(field, term, Field.Store.NO, Field.Index.NOT_ANALYZED));
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setTokenized(false);
+ doc.add(newField(field, term, customType));
w.addDocument(doc);
}
uniqueTermCount += uniqueTerms.size();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java Mon Aug 15 22:03:41 2011
@@ -23,6 +23,8 @@ import java.util.Random;
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.index.IndexReader;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.index.RandomIndexWriter;
@@ -116,9 +118,11 @@ public class BaseTestRangeFilter extends
/* build an index */
Document doc = new Document();
- Field idField = newField(random, "id", "", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
- Field randField = newField(random, "rand", "", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
- Field bodyField = newField(random, "body", "", Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS);
+ FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
+ customType.setStored(true);
+ Field idField = newField(random, "id", "", customType);
+ Field randField = newField(random, "rand", "", customType);
+ Field bodyField = newField(random, "body", "", StringField.TYPE_UNSTORED);
doc.add(idField);
doc.add(randField);
doc.add(bodyField);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java Mon Aug 15 22:03:41 2011
@@ -21,6 +21,7 @@ import java.io.IOException;
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.MultiFields;
import org.apache.lucene.index.RandomIndexWriter;
@@ -46,12 +47,9 @@ public class TestAutomatonQuery extends
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
Document doc = new Document();
- Field titleField = newField("title", "some title", Field.Store.NO,
- Field.Index.ANALYZED);
- Field field = newField(FN, "this is document one 2345", Field.Store.NO,
- Field.Index.ANALYZED);
- Field footerField = newField("footer", "a footer", Field.Store.NO,
- Field.Index.ANALYZED);
+ Field titleField = newField("title", "some title", TextField.TYPE_UNSTORED);
+ Field field = newField(FN, "this is document one 2345", TextField.TYPE_UNSTORED);
+ Field footerField = newField("footer", "a footer", TextField.TYPE_UNSTORED);
doc.add(titleField);
doc.add(field);
doc.add(footerField);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java Mon Aug 15 22:03:41 2011
@@ -21,6 +21,7 @@ import java.io.IOException;
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;
@@ -47,12 +48,9 @@ public class TestAutomatonQueryUnicode e
directory = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, directory);
Document doc = new Document();
- Field titleField = newField("title", "some title", Field.Store.NO,
- Field.Index.ANALYZED);
- Field field = newField(FN, "", Field.Store.NO,
- Field.Index.ANALYZED);
- Field footerField = newField("footer", "a footer", Field.Store.NO,
- Field.Index.ANALYZED);
+ Field titleField = newField("title", "some title", TextField.TYPE_UNSTORED);
+ Field field = newField(FN, "", TextField.TYPE_UNSTORED);
+ Field footerField = newField("footer", "a footer", TextField.TYPE_UNSTORED);
doc.add(titleField);
doc.add(field);
doc.add(footerField);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBoolean2.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBoolean2.java Mon Aug 15 22:03:41 2011
@@ -23,6 +23,7 @@ import java.util.Random;
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.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexReader;
@@ -56,7 +57,7 @@ public class TestBoolean2 extends Lucene
RandomIndexWriter writer= new RandomIndexWriter(random, directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
- doc.add(newField(field, docFields[i], Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(newField(field, docFields[i], TextField.TYPE_UNSTORED));
writer.addDocument(doc);
}
writer.close();
@@ -81,12 +82,12 @@ public class TestBoolean2 extends Lucene
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))
.setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
Document doc = new Document();
- doc.add(newField("field2", "xxx", Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(newField("field2", "xxx", TextField.TYPE_UNSTORED));
for(int i=0;i<NUM_EXTRA_DOCS/2;i++) {
w.addDocument(doc);
}
doc = new Document();
- doc.add(newField("field2", "big bad bug", Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(newField("field2", "big bad bug", TextField.TYPE_UNSTORED));
for(int i=0;i<NUM_EXTRA_DOCS/2;i++) {
w.addDocument(doc);
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Mon Aug 15 22:03:41 2011
@@ -20,6 +20,9 @@ package org.apache.lucene.search;
import org.apache.lucene.util.LuceneTestCase;
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;
import org.apache.lucene.index.Term;
@@ -54,12 +57,17 @@ public class TestBooleanMinShouldMatch e
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), Field.Store.YES, Field.Index.NOT_ANALYZED));//Field.Keyword("id",String.valueOf(i)));
- doc.add(newField("all", "all", Field.Store.YES, Field.Index.NOT_ANALYZED));//Field.Keyword("all","all"));
+ 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], Field.Store.YES, Field.Index.ANALYZED));//Field.Text("data",data[i]));
+ doc.add(newField("data", data[i], customType2));//Field.Text("data",data[i]));
}
w.addDocument(doc);
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java Mon Aug 15 22:03:41 2011
@@ -21,6 +21,8 @@ import org.apache.lucene.util.LuceneTest
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;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -138,16 +140,16 @@ public class TestBooleanOr extends Lucen
//
Document d = new Document();
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStored(true);
d.add(newField(
FIELD_T,
"Optimize not deleting all files",
- Field.Store.YES,
- Field.Index.ANALYZED));
+ customType));
d.add(newField(
FIELD_C,
"Deleted When I run an optimize in our production environment.",
- Field.Store.YES,
- Field.Index.ANALYZED));
+ customType));
//
writer.addDocument(d);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java Mon Aug 15 22:03:41 2011
@@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
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.MultiReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -68,7 +69,7 @@ public class TestBooleanQuery extends Lu
Directory dir = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random, dir);
Document doc = new Document();
- doc.add(newField("field", "a b c d", Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(newField("field", "a b c d", TextField.TYPE_UNSTORED));
w.addDocument(doc);
IndexReader r = w.getReader();
@@ -129,7 +130,7 @@ public class TestBooleanQuery extends Lu
Directory dir1 = newDirectory();
RandomIndexWriter iw1 = new RandomIndexWriter(random, dir1);
Document doc1 = new Document();
- doc1.add(newField("field", "foo bar", Field.Index.ANALYZED));
+ doc1.add(newField("field", "foo bar", TextField.TYPE_UNSTORED));
iw1.addDocument(doc1);
IndexReader reader1 = iw1.getReader();
iw1.close();
@@ -137,7 +138,7 @@ public class TestBooleanQuery extends Lu
Directory dir2 = newDirectory();
RandomIndexWriter iw2 = new RandomIndexWriter(random, dir2);
Document doc2 = new Document();
- doc2.add(newField("field", "foo baz", Field.Index.ANALYZED));
+ doc2.add(newField("field", "foo baz", TextField.TYPE_UNSTORED));
iw2.addDocument(doc2);
IndexReader reader2 = iw2.getReader();
iw2.close();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java Mon Aug 15 22:03:41 2011
@@ -22,6 +22,8 @@ import java.util.Arrays;
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.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -40,9 +42,11 @@ public class TestBooleanScorer extends L
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], Field.Store.YES, Field.Index.NOT_ANALYZED));
+ doc.add(newField(FIELD, values[i], customType));
writer.addDocument(doc);
}
IndexReader ir = writer.getReader();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java Mon Aug 15 22:03:41 2011
@@ -22,6 +22,9 @@ 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.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.SerialMergeScheduler;
@@ -54,7 +57,10 @@ public class TestCachingSpanFilter exten
// add a doc, refresh the reader, and check that its there
Document doc = new Document();
- doc.add(newField("id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED));
+ FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
+ customType.setStored(true);
+ customType.setTokenized(false);
+ doc.add(newField("id", "1", customType));
writer.addDocument(doc);
reader = refreshReader(reader);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java Mon Aug 15 22:03:41 2011
@@ -22,6 +22,8 @@ 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.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -175,7 +177,10 @@ public class TestCachingWrapperFilter ex
// add a doc, refresh the reader, and check that its there
Document doc = new Document();
- doc.add(newField("id", "1", Field.Store.YES, Field.Index.NOT_ANALYZED));
+ FieldType customType = new FieldType(StringField.TYPE_UNSTORED);
+ customType.setStored(true);
+ customType.setTokenized(false);
+ doc.add(newField("id", "1", customType));
writer.addDocument(doc);
reader = refreshReader(reader);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java Mon Aug 15 22:03:41 2011
@@ -19,6 +19,7 @@ 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.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.RandomIndexWriter;
@@ -89,7 +90,7 @@ public class TestConstantScoreQuery exte
RandomIndexWriter writer = new RandomIndexWriter (random, directory);
Document doc = new Document();
- doc.add(newField("field", "term", Field.Store.NO, Field.Index.NOT_ANALYZED));
+ doc.add(newField("field", "term", StringField.TYPE_UNSTORED));
writer.addDocument(doc);
reader = writer.getReader();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestCustomSearcherSort.java Mon Aug 15 22:03:41 2011
@@ -25,7 +25,8 @@ import java.util.TreeMap;
import org.apache.lucene.document.DateTools;
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;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -51,21 +52,23 @@ public class TestCustomSearcherSort exte
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(),
- Field.Store.YES, Field.Index.NOT_ANALYZED));
+ doc.add(newField("publicationDate_", random.getLuceneDate(), customType));
}
if ((i % 7) == 0) { // some documents to match the query (see below)
- doc.add(newField("content", "test", Field.Store.YES,
- Field.Index.ANALYZED));
+ doc.add(newField("content", "test", customType2));
}
// every document has a defined 'mandant' field
- doc.add(newField("mandant", Integer.toString(i % 3), Field.Store.YES,
- Field.Index.NOT_ANALYZED));
+ doc.add(newField("mandant", Integer.toString(i % 3), customType));
writer.addDocument(doc);
}
reader = writer.getReader();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateFilter.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateFilter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateFilter.java Mon Aug 15 22:03:41 2011
@@ -22,6 +22,8 @@ import org.apache.lucene.util.LuceneTest
import org.apache.lucene.document.DateTools;
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;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
@@ -47,11 +49,13 @@ public class TestDateFilter extends Luce
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), Field.Store.YES,
- Field.Index.NOT_ANALYZED));
+ DateTools.Resolution.MILLISECOND), customType));
doc.add(newField("body", "Today is a very sunny day in New York City",
- Field.Store.YES, Field.Index.ANALYZED));
+ customType2));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
@@ -114,11 +118,13 @@ public class TestDateFilter extends Luce
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), Field.Store.YES,
- Field.Index.NOT_ANALYZED));
+ DateTools.Resolution.MILLISECOND), customType));
doc.add(newField("body", "Today is a very sunny day in New York City",
- Field.Store.YES, Field.Index.ANALYZED));
+ customType2));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateSort.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateSort.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDateSort.java Mon Aug 15 22:03:41 2011
@@ -26,6 +26,8 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.document.DateTools;
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.search.Query;
@@ -107,13 +109,12 @@ public class TestDateSort extends Lucene
Document document = new Document();
// Add the text field.
- Field textField = newField(TEXT_FIELD, text, Field.Store.YES, Field.Index.ANALYZED);
+ Field textField = newField(TEXT_FIELD, text, TextField.TYPE_STORED);
document.add(textField);
// Add the date/time field.
String dateTimeString = DateTools.timeToString(time, DateTools.Resolution.SECOND);
- Field dateTimeField = newField(DATE_TIME_FIELD, dateTimeString, Field.Store.YES,
- Field.Index.NOT_ANALYZED);
+ Field dateTimeField = newField(DATE_TIME_FIELD, dateTimeString, StringField.TYPE_STORED);
document.add(dateTimeField);
return document;
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Mon Aug 15 22:03:41 2011
@@ -21,6 +21,9 @@ import org.apache.lucene.util.LuceneTest
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.IndexReader;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.SlowMultiReaderWrapper;
@@ -83,6 +86,11 @@ public class TestDisjunctionMaxQuery ext
public IndexReader r;
public IndexSearcher s;
+ private static final FieldType nonAnalyzedType = new FieldType(TextField.TYPE_STORED);
+ static {
+ nonAnalyzedType.setTokenized(false);
+ }
+
@Override
public void setUp() throws Exception {
super.setUp();
@@ -97,57 +105,51 @@ public class TestDisjunctionMaxQuery ext
// d1 is an "ok" match for: albino elephant
{
Document d1 = new Document();
- d1.add(newField("id", "d1", Field.Store.YES, Field.Index.NOT_ANALYZED));// Field.Keyword("id",
+ d1.add(newField("id", "d1", nonAnalyzedType));// Field.Keyword("id",
// "d1"));
d1
- .add(newField("hed", "elephant", Field.Store.YES,
- Field.Index.ANALYZED));// Field.Text("hed", "elephant"));
+ .add(newField("hed", "elephant", TextField.TYPE_STORED));// Field.Text("hed", "elephant"));
d1
- .add(newField("dek", "elephant", Field.Store.YES,
- Field.Index.ANALYZED));// Field.Text("dek", "elephant"));
+ .add(newField("dek", "elephant", TextField.TYPE_STORED));// Field.Text("dek", "elephant"));
writer.addDocument(d1);
}
// d2 is a "good" match for: albino elephant
{
Document d2 = new Document();
- d2.add(newField("id", "d2", Field.Store.YES, Field.Index.NOT_ANALYZED));// Field.Keyword("id",
+ d2.add(newField("id", "d2", nonAnalyzedType));// Field.Keyword("id",
// "d2"));
d2
- .add(newField("hed", "elephant", Field.Store.YES,
- Field.Index.ANALYZED));// Field.Text("hed", "elephant"));
- d2.add(newField("dek", "albino", Field.Store.YES, Field.Index.ANALYZED));// Field.Text("dek",
+ .add(newField("hed", "elephant", TextField.TYPE_STORED));// Field.Text("hed", "elephant"));
+ d2.add(newField("dek", "albino", TextField.TYPE_STORED));// Field.Text("dek",
// "albino"));
d2
- .add(newField("dek", "elephant", Field.Store.YES,
- Field.Index.ANALYZED));// Field.Text("dek", "elephant"));
+ .add(newField("dek", "elephant", TextField.TYPE_STORED));// Field.Text("dek", "elephant"));
writer.addDocument(d2);
}
// d3 is a "better" match for: albino elephant
{
Document d3 = new Document();
- d3.add(newField("id", "d3", Field.Store.YES, Field.Index.NOT_ANALYZED));// Field.Keyword("id",
+ d3.add(newField("id", "d3", nonAnalyzedType));// Field.Keyword("id",
// "d3"));
- d3.add(newField("hed", "albino", Field.Store.YES, Field.Index.ANALYZED));// Field.Text("hed",
+ d3.add(newField("hed", "albino", TextField.TYPE_STORED));// Field.Text("hed",
// "albino"));
d3
- .add(newField("hed", "elephant", Field.Store.YES,
- Field.Index.ANALYZED));// Field.Text("hed", "elephant"));
+ .add(newField("hed", "elephant", TextField.TYPE_STORED));// Field.Text("hed", "elephant"));
writer.addDocument(d3);
}
// d4 is the "best" match for: albino elephant
{
Document d4 = new Document();
- d4.add(newField("id", "d4", Field.Store.YES, Field.Index.NOT_ANALYZED));// Field.Keyword("id",
+ d4.add(newField("id", "d4", nonAnalyzedType));// Field.Keyword("id",
// "d4"));
- d4.add(newField("hed", "albino", Field.Store.YES, Field.Index.ANALYZED));// Field.Text("hed",
+ d4.add(newField("hed", "albino", TextField.TYPE_STORED));// Field.Text("hed",
// "albino"));
d4
- .add(newField("hed", "elephant", Field.Store.YES,
- Field.Index.ANALYZED));// Field.Text("hed", "elephant"));
- d4.add(newField("dek", "albino", Field.Store.YES, Field.Index.ANALYZED));// Field.Text("dek",
+ .add(newField("hed", "elephant", nonAnalyzedType));// Field.Text("hed", "elephant"));
+ d4.add(newField("dek", "albino", TextField.TYPE_STORED));// Field.Text("dek",
// "albino"));
writer.addDocument(d4);
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocBoost.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocBoost.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocBoost.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocBoost.java Mon Aug 15 22:03:41 2011
@@ -23,6 +23,7 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.document.*;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.IndexableField;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.store.Directory;
@@ -38,26 +39,26 @@ public class TestDocBoost extends Lucene
Directory store = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, store, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
- Fieldable f1 = newField("field", "word", Field.Store.YES, Field.Index.ANALYZED);
- Fieldable f2 = newField("field", "word", Field.Store.YES, Field.Index.ANALYZED);
+ Field f1 = newField("field", "word", TextField.TYPE_STORED);
+ Field f2 = newField("field", "word", TextField.TYPE_STORED);
f2.setBoost(2.0f);
Document d1 = new Document();
Document d2 = new Document();
Document d3 = new Document();
Document d4 = new Document();
- d3.setBoost(3.0f);
- d4.setBoost(2.0f);
+ //d3.setBoost(3.0f);
+ //d4.setBoost(2.0f);
d1.add(f1); // boost = 1
d2.add(f2); // boost = 2
- d3.add(f1); // boost = 3
- d4.add(f2); // boost = 4
+ //d3.add(f1); // boost = 3
+ //d4.add(f2); // boost = 4
writer.addDocument(d1);
writer.addDocument(d2);
- writer.addDocument(d3);
- writer.addDocument(d4);
+ //writer.addDocument(d3);
+ //writer.addDocument(d4);
IndexReader reader = writer.getReader();
writer.close();
@@ -89,7 +90,7 @@ public class TestDocBoost extends Lucene
float lastScore = 0.0f;
- for (int i = 0; i < 4; i++) {
+ for (int i = 0; i < 2; i++) {
assertTrue(scores[i] > lastScore);
lastScore = scores[i];
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java Mon Aug 15 22:03:41 2011
@@ -25,8 +25,8 @@ import java.util.Iterator;
import junit.framework.Assert;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field.Index;
-import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.RandomIndexWriter;
@@ -103,7 +103,7 @@ public class TestDocIdSet extends Lucene
Directory dir = newDirectory();
RandomIndexWriter writer = new RandomIndexWriter(random, dir);
Document doc = new Document();
- doc.add(newField("c", "val", Store.NO, Index.NOT_ANALYZED_NO_NORMS));
+ doc.add(newField("c", "val", StringField.TYPE_UNSTORED));
writer.addDocument(doc);
IndexReader reader = writer.getReader();
writer.close();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java Mon Aug 15 22:03:41 2011
@@ -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.Field;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.*;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.search.FieldValueHitQueue.Entry;
@@ -124,7 +125,7 @@ public class TestElevationComparator ext
private Document adoc(String[] vals) {
Document doc = new Document();
for (int i = 0; i < vals.length - 2; i += 2) {
- doc.add(newField(vals[i], vals[i + 1], Field.Store.YES, Field.Index.ANALYZED));
+ doc.add(newField(vals[i], vals[i + 1], TextField.TYPE_STORED));
}
return doc;
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestExplanations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestExplanations.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestExplanations.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestExplanations.java Mon Aug 15 22:03:41 2011
@@ -20,6 +20,8 @@ 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.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;
@@ -73,11 +75,11 @@ public class TestExplanations extends Lu
RandomIndexWriter writer= new RandomIndexWriter(random, directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
for (int i = 0; i < docFields.length; i++) {
Document doc = new Document();
- doc.add(newField(KEY, ""+i, Field.Store.NO, Field.Index.NOT_ANALYZED));
- Field f = newField(FIELD, docFields[i], Field.Store.NO, Field.Index.ANALYZED);
+ doc.add(newField(KEY, ""+i, StringField.TYPE_UNSTORED));
+ Field f = newField(FIELD, docFields[i], TextField.TYPE_UNSTORED);
f.setBoost(i);
doc.add(f);
- doc.add(newField(ALTFIELD, docFields[i], Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(newField(ALTFIELD, docFields[i], TextField.TYPE_UNSTORED));
writer.addDocument(doc);
}
reader = writer.getReader();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCache.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCache.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCache.java Mon Aug 15 22:03:41 2011
@@ -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.StringField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.RandomIndexWriter;
@@ -56,12 +57,12 @@ public class TestFieldCache extends Luce
writer.w.setInfoStream(VERBOSE ? System.out : null);
for (int i = 0; i < NUM_DOCS; i++){
Document doc = new Document();
- doc.add(newField("theLong", String.valueOf(theLong--), Field.Store.NO, Field.Index.NOT_ANALYZED));
- doc.add(newField("theDouble", String.valueOf(theDouble--), Field.Store.NO, Field.Index.NOT_ANALYZED));
- doc.add(newField("theByte", String.valueOf(theByte--), Field.Store.NO, Field.Index.NOT_ANALYZED));
- doc.add(newField("theShort", String.valueOf(theShort--), Field.Store.NO, Field.Index.NOT_ANALYZED));
- doc.add(newField("theInt", String.valueOf(theInt--), Field.Store.NO, Field.Index.NOT_ANALYZED));
- doc.add(newField("theFloat", String.valueOf(theFloat--), Field.Store.NO, Field.Index.NOT_ANALYZED));
+ doc.add(newField("theLong", String.valueOf(theLong--), StringField.TYPE_UNSTORED));
+ doc.add(newField("theDouble", String.valueOf(theDouble--), StringField.TYPE_UNSTORED));
+ doc.add(newField("theByte", String.valueOf(theByte--), StringField.TYPE_UNSTORED));
+ doc.add(newField("theShort", String.valueOf(theShort--), StringField.TYPE_UNSTORED));
+ doc.add(newField("theInt", String.valueOf(theInt--), StringField.TYPE_UNSTORED));
+ doc.add(newField("theFloat", String.valueOf(theFloat--), StringField.TYPE_UNSTORED));
// sometimes skip the field:
if (random.nextInt(40) != 17) {
@@ -78,7 +79,7 @@ public class TestFieldCache extends Luce
s = _TestUtil.randomUnicodeString(random, 250);
}
unicodeStrings[i] = s;
- doc.add(newField("theRandomUnicodeString", unicodeStrings[i], Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
+ doc.add(newField("theRandomUnicodeString", unicodeStrings[i], StringField.TYPE_UNSTORED));
}
writer.addDocument(doc);
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java Mon Aug 15 22:03:41 2011
@@ -26,6 +26,7 @@ import org.apache.lucene.index.IndexWrit
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.store.Directory;
import org.junit.Test;
@@ -535,8 +536,8 @@ public class TestFieldCacheRangeFilter e
for (int d = -20; d <= 20; d++) {
Document doc = new Document();
- doc.add(newField("id",Integer.toString(d), Field.Store.NO, Field.Index.NOT_ANALYZED));
- doc.add(newField("body","body", Field.Store.NO, Field.Index.NOT_ANALYZED));
+ doc.add(newField("id",Integer.toString(d), StringField.TYPE_UNSTORED));
+ doc.add(newField("body","body", StringField.TYPE_UNSTORED));
writer.addDocument(doc);
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java Mon Aug 15 22:03:41 2011
@@ -21,6 +21,7 @@ import org.apache.lucene.util.LuceneTest
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.store.Directory;
@@ -41,7 +42,7 @@ public class TestFieldCacheTermsFilter e
for (int i = 0; i < 100; i++) {
Document doc = new Document();
int term = i * 10; //terms are units of 10;
- doc.add(newField(fieldName, "" + term, Field.Store.YES, Field.Index.NOT_ANALYZED));
+ doc.add(newField(fieldName, "" + term, StringField.TYPE_STORED));
w.addDocument(doc);
}
IndexReader reader = w.getReader();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java Mon Aug 15 22:03:41 2011
@@ -22,6 +22,7 @@ import java.util.BitSet;
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.AtomicReaderContext;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -54,23 +55,23 @@ public class TestFilteredQuery extends L
RandomIndexWriter writer = new RandomIndexWriter (random, directory, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
Document doc = new Document();
- doc.add (newField("field", "one two three four five", Field.Store.YES, Field.Index.ANALYZED));
- doc.add (newField("sorter", "b", Field.Store.YES, Field.Index.ANALYZED));
+ doc.add (newField("field", "one two three four five", TextField.TYPE_STORED));
+ doc.add (newField("sorter", "b", TextField.TYPE_STORED));
writer.addDocument (doc);
doc = new Document();
- doc.add (newField("field", "one two three four", Field.Store.YES, Field.Index.ANALYZED));
- doc.add (newField("sorter", "d", Field.Store.YES, Field.Index.ANALYZED));
+ doc.add (newField("field", "one two three four", TextField.TYPE_STORED));
+ doc.add (newField("sorter", "d", TextField.TYPE_STORED));
writer.addDocument (doc);
doc = new Document();
- doc.add (newField("field", "one two three y", Field.Store.YES, Field.Index.ANALYZED));
- doc.add (newField("sorter", "a", Field.Store.YES, Field.Index.ANALYZED));
+ doc.add (newField("field", "one two three y", TextField.TYPE_STORED));
+ doc.add (newField("sorter", "a", TextField.TYPE_STORED));
writer.addDocument (doc);
doc = new Document();
- doc.add (newField("field", "one two x", Field.Store.YES, Field.Index.ANALYZED));
- doc.add (newField("sorter", "c", Field.Store.YES, Field.Index.ANALYZED));
+ doc.add (newField("field", "one two x", TextField.TYPE_STORED));
+ doc.add (newField("sorter", "c", TextField.TYPE_STORED));
writer.addDocument (doc);
// tests here require single segment (eg try seed
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFilteredSearch.java Mon Aug 15 22:03:41 2011
@@ -22,7 +22,7 @@ import java.io.IOException;
import org.apache.lucene.util.LuceneTestCase;
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.CorruptIndexException;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexWriter;
@@ -64,7 +64,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), Field.Store.YES, Field.Index.NOT_ANALYZED));
+ doc.add(newField(FIELD, Integer.toString(i), StringField.TYPE_STORED));
writer.addDocument(doc);
}
if(optimize)
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java Mon Aug 15 22:03:41 2011
@@ -24,6 +24,7 @@ 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.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiReader;
import org.apache.lucene.index.RandomIndexWriter;
@@ -464,7 +465,7 @@ public class TestFuzzyQuery extends Luce
private void addDoc(String text, RandomIndexWriter writer) throws IOException {
Document doc = new Document();
- doc.add(newField("field", text, Field.Store.YES, Field.Index.ANALYZED));
+ doc.add(newField("field", text, TextField.TYPE_STORED));
writer.addDocument(doc);
}
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java Mon Aug 15 22:03:41 2011
@@ -25,6 +25,7 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.analysis.MockTokenizer;
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;
@@ -85,7 +86,7 @@ public class TestFuzzyQuery2 extends Luc
RandomIndexWriter writer = new RandomIndexWriter(random, dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.KEYWORD, false)).setMergePolicy(newLogMergePolicy()));
Document doc = new Document();
- Field field = newField("field", "", Field.Store.NO, Field.Index.ANALYZED);
+ Field field = newField("field", "", TextField.TYPE_UNSTORED);
doc.add(field);
for (int i = 0; i < terms; i++) {
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java Mon Aug 15 22:03:41 2011
@@ -22,6 +22,7 @@ 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.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexReader;
@@ -89,7 +90,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, Field.Store.YES, Field.Index.ANALYZED);
+ Field f = newField("key", text, TextField.TYPE_STORED);
f.setBoost(boost);
doc.add(f);
iw.addDocument(doc);
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java Mon Aug 15 22:03:41 2011
@@ -33,6 +33,8 @@ import org.apache.lucene.analysis.tokena
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
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.IndexWriter;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.store.RAMDirectory;
@@ -164,7 +166,7 @@ public class TestMultiPhraseQuery extend
private void add(String s, RandomIndexWriter writer) throws IOException {
Document doc = new Document();
- doc.add(newField("body", s, Field.Store.YES, Field.Index.ANALYZED));
+ doc.add(newField("body", s, TextField.TYPE_STORED));
writer.addDocument(doc);
}
@@ -287,8 +289,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, Field.Store.YES, Field.Index.ANALYZED));
- doc.add(newField("type", type, Field.Store.YES, Field.Index.NOT_ANALYZED));
+ doc.add(newField("body", s, TextField.TYPE_STORED));
+ doc.add(newField("type", type, StringField.TYPE_UNSTORED));
writer.addDocument(doc);
}
@@ -389,7 +391,7 @@ public class TestMultiPhraseQuery extend
RandomIndexWriter writer = new RandomIndexWriter(random, dir, new CannedAnalyzer(tokens));
Document doc = new Document();
- doc.add(new Field("field", "", Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(new TextField("field", ""));
writer.addDocument(doc);
writer.addDocument(doc);
IndexReader r = writer.getReader();
@@ -481,7 +483,7 @@ public class TestMultiPhraseQuery extend
IndexWriterConfig cfg = newIndexWriterConfig(TEST_VERSION_CURRENT, new CannedAnalyzer(INCR_0_DOC_TOKENS));
IndexWriter writer = new IndexWriter(dir, cfg);
Document doc = new Document();
- doc.add(new Field("field", "", Field.Store.NO, Field.Index.ANALYZED));
+ doc.add(new TextField("field", ""));
writer.addDocument(doc);
IndexReader r = IndexReader.open(writer,false);
writer.close();
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java Mon Aug 15 22:03:41 2011
@@ -20,7 +20,9 @@ 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.StringField;
+import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.IndexWriterConfig;
@@ -64,16 +66,14 @@ public class TestMultiTermConstantScore
newIndexWriterConfig(TEST_VERSION_CURRENT,
new MockAnalyzer(random, MockTokenizer.WHITESPACE, false)).setMergePolicy(newLogMergePolicy()));
+ FieldType customType = new FieldType(TextField.TYPE_STORED);
+ customType.setTokenized(false);
for (int i = 0; i < data.length; i++) {
Document doc = new Document();
- doc.add(newField("id", String.valueOf(i), Field.Store.YES,
- Field.Index.NOT_ANALYZED));// Field.Keyword("id",String.valueOf(i)));
- doc
- .add(newField("all", "all", Field.Store.YES,
- Field.Index.NOT_ANALYZED));// Field.Keyword("all","all"));
+ 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], Field.Store.YES,
- Field.Index.ANALYZED));// Field.Text("data",data[i]));
+ doc.add(newField("data", data[i], TextField.TYPE_STORED));// Field.Text("data",data[i]));
}
writer.addDocument(doc);
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java Mon Aug 15 22:03:41 2011
@@ -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.Field;
+import org.apache.lucene.document.StringField;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.MultiReader;
@@ -53,7 +54,7 @@ public class TestMultiTermQueryRewrites
for (int i = 0; i < 10; i++) {
Document doc = new Document();
- doc.add(newField("data", Integer.toString(i), Field.Store.NO, Field.Index.NOT_ANALYZED));
+ doc.add(newField("data", Integer.toString(i), StringField.TYPE_UNSTORED));
writer.addDocument(doc);
((i % 2 == 0) ? swriter1 : swriter2).addDocument(doc);
}
Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java?rev=1158029&r1=1158028&r2=1158029&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java Mon Aug 15 22:03:41 2011
@@ -41,9 +41,13 @@ public class TestMultiThreadTermVectors
IndexWriter writer = new IndexWriter(directory, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
//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++) {
Document doc = new Document();
- Fieldable fld = newField("field", English.intToEnglish(i), Field.Store.YES, Field.Index.NOT_ANALYZED, Field.TermVector.YES);
+ Field fld = newField("field", English.intToEnglish(i), customType);
doc.add(fld);
writer.addDocument(doc);
}