Index: solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java =================================================================== --- solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java (revision 1176728) +++ solr/core/src/test/org/apache/solr/core/TestArbitraryIndexDir.java (working copy) @@ -106,8 +106,8 @@ new IndexWriterConfig(Version.LUCENE_40, new StandardAnalyzer(Version.LUCENE_40)) ); Document doc = new Document(); - doc.add(new Field("id", TextField.TYPE_STORED, "2")); - doc.add(new Field("name", TextField.TYPE_STORED, "name2")); + doc.add(new Field("id", "2", TextField.TYPE_STORED)); + doc.add(new Field("name", "name2", TextField.TYPE_STORED)); iw.addDocument(doc); iw.commit(); iw.close(); Index: solr/core/src/test/org/apache/solr/search/TestSort.java =================================================================== --- solr/core/src/test/org/apache/solr/search/TestSort.java (revision 1176728) +++ solr/core/src/test/org/apache/solr/search/TestSort.java (working copy) @@ -150,8 +150,8 @@ public void testSort() throws Exception { Directory dir = new RAMDirectory(); - Field f = new Field("f", StringField.TYPE_UNSTORED,"0"); - Field f2 = new Field("f2", StringField.TYPE_UNSTORED,"0"); + Field f = new Field("f", "0", StringField.TYPE_UNSTORED); + Field f2 = new Field("f2", "0", StringField.TYPE_UNSTORED); for (int iterCnt = 0; iterCnt(); // Initialize the map with the default fields. - fields.put(BODY_FIELD, new Field(BODY_FIELD, bodyFt, "")); - fields.put(TITLE_FIELD, new Field(TITLE_FIELD, ft, "")); - fields.put(DATE_FIELD, new Field(DATE_FIELD, ft, "")); - fields.put(ID_FIELD, new Field(ID_FIELD, StringField.TYPE_STORED, "")); - fields.put(NAME_FIELD, new Field(NAME_FIELD, ft, "")); + fields.put(BODY_FIELD, new Field(BODY_FIELD, "", bodyFt)); + fields.put(TITLE_FIELD, new Field(TITLE_FIELD, "", ft)); + fields.put(DATE_FIELD, new Field(DATE_FIELD, "", ft)); + fields.put(ID_FIELD, new Field(ID_FIELD, "", StringField.TYPE_STORED)); + fields.put(NAME_FIELD, new Field(NAME_FIELD, "", ft)); numericFields.put(DATE_MSEC_FIELD, new NumericField(DATE_MSEC_FIELD)); numericFields.put(TIME_SEC_FIELD, new NumericField(TIME_SEC_FIELD)); @@ -127,12 +127,12 @@ */ Field getField(String name, FieldType ft) { if (!reuseFields) { - return new Field(name, ft, ""); + return new Field(name, "", ft); } Field f = fields.get(name); if (f == null) { - f = new Field(name, ft, ""); + f = new Field(name, "", ft); fields.put(name, f); } return f; Index: modules/grouping/src/test/org/apache/lucene/search/grouping/TermAllGroupsCollectorTest.java =================================================================== --- modules/grouping/src/test/org/apache/lucene/search/grouping/TermAllGroupsCollectorTest.java (revision 1176728) +++ modules/grouping/src/test/org/apache/lucene/search/grouping/TermAllGroupsCollectorTest.java (working copy) @@ -45,51 +45,51 @@ new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy())); // 0 Document doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author1")); - doc.add(new Field("content", TextField.TYPE_STORED, "random text")); - doc.add(new Field("id", customType, "1")); + doc.add(new Field(groupField, "author1", TextField.TYPE_STORED)); + doc.add(new Field("content", "random text", TextField.TYPE_STORED)); + doc.add(new Field("id", "1", customType)); w.addDocument(doc); // 1 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author1")); - doc.add(new Field("content", TextField.TYPE_STORED, "some more random text blob")); - doc.add(new Field("id", customType, "2")); + doc.add(new Field(groupField, "author1", TextField.TYPE_STORED)); + doc.add(new Field("content", "some more random text blob", TextField.TYPE_STORED)); + doc.add(new Field("id", "2", customType)); w.addDocument(doc); // 2 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author1")); - doc.add(new Field("content", TextField.TYPE_STORED, "some more random textual data")); - doc.add(new Field("id", customType, "3")); + doc.add(new Field(groupField, "author1", TextField.TYPE_STORED)); + doc.add(new Field("content", "some more random textual data", TextField.TYPE_STORED)); + doc.add(new Field("id", "3", customType)); w.addDocument(doc); w.commit(); // To ensure a second segment // 3 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author2")); - doc.add(new Field("content", TextField.TYPE_STORED, "some random text")); - doc.add(new Field("id", customType, "4")); + doc.add(new Field(groupField, "author2", TextField.TYPE_STORED)); + doc.add(new Field("content", "some random text", TextField.TYPE_STORED)); + doc.add(new Field("id", "4", customType)); w.addDocument(doc); // 4 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author3")); - doc.add(new Field("content", TextField.TYPE_STORED, "some more random text")); - doc.add(new Field("id", customType, "5")); + doc.add(new Field(groupField, "author3", TextField.TYPE_STORED)); + doc.add(new Field("content", "some more random text", TextField.TYPE_STORED)); + doc.add(new Field("id", "5", customType)); w.addDocument(doc); // 5 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author3")); - doc.add(new Field("content", TextField.TYPE_STORED, "random blob")); - doc.add(new Field("id", customType, "6")); + doc.add(new Field(groupField, "author3", TextField.TYPE_STORED)); + doc.add(new Field("content", "random blob", TextField.TYPE_STORED)); + doc.add(new Field("id", "6", customType)); w.addDocument(doc); // 6 -- no author field doc = new Document(); - doc.add(new Field("content", TextField.TYPE_STORED, "random word stuck in alot of other text")); - doc.add(new Field("id", customType, "6")); + doc.add(new Field("content", "random word stuck in alot of other text", TextField.TYPE_STORED)); + doc.add(new Field("id", "6", customType)); w.addDocument(doc); IndexSearcher indexSearcher = new IndexSearcher(w.getReader()); Index: modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java =================================================================== --- modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (revision 1176728) +++ modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (working copy) @@ -61,50 +61,50 @@ new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy())); // 0 Document doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author1")); - doc.add(new Field("content", TextField.TYPE_STORED, "random text")); - doc.add(new Field("id", customType, "1")); + doc.add(new Field(groupField, "author1", TextField.TYPE_STORED)); + doc.add(new Field("content", "random text", TextField.TYPE_STORED)); + doc.add(new Field("id", "1", customType)); w.addDocument(doc); // 1 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author1")); - doc.add(new Field("content", TextField.TYPE_STORED, "some more random text")); - doc.add(new Field("id", customType, "2")); + doc.add(new Field(groupField, "author1", TextField.TYPE_STORED)); + doc.add(new Field("content", "some more random text", TextField.TYPE_STORED)); + doc.add(new Field("id", "2", customType)); w.addDocument(doc); // 2 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author1")); - doc.add(new Field("content", TextField.TYPE_STORED, "some more random textual data")); - doc.add(new Field("id", customType, "3")); + doc.add(new Field(groupField, "author1", TextField.TYPE_STORED)); + doc.add(new Field("content", "some more random textual data", TextField.TYPE_STORED)); + doc.add(new Field("id", "3", customType)); w.addDocument(doc); // 3 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author2")); - doc.add(new Field("content", TextField.TYPE_STORED, "some random text")); - doc.add(new Field("id", customType, "4")); + doc.add(new Field(groupField, "author2", TextField.TYPE_STORED)); + doc.add(new Field("content", "some random text", TextField.TYPE_STORED)); + doc.add(new Field("id", "4", customType)); w.addDocument(doc); // 4 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author3")); - doc.add(new Field("content", TextField.TYPE_STORED, "some more random text")); - doc.add(new Field("id", customType, "5")); + doc.add(new Field(groupField, "author3", TextField.TYPE_STORED)); + doc.add(new Field("content", "some more random text", TextField.TYPE_STORED)); + doc.add(new Field("id", "5", customType)); w.addDocument(doc); // 5 doc = new Document(); - doc.add(new Field(groupField, TextField.TYPE_STORED, "author3")); - doc.add(new Field("content", TextField.TYPE_STORED, "random")); - doc.add(new Field("id", customType, "6")); + doc.add(new Field(groupField, "author3", TextField.TYPE_STORED)); + doc.add(new Field("content", "random", TextField.TYPE_STORED)); + doc.add(new Field("id", "6", customType)); w.addDocument(doc); // 6 -- no author field doc = new Document(); - doc.add(new Field("content", TextField.TYPE_STORED, "random word stuck in alot of other text")); - doc.add(new Field("id", customType, "6")); + doc.add(new Field("content", "random word stuck in alot of other text", TextField.TYPE_STORED)); + doc.add(new Field("id", "6", customType)); w.addDocument(doc); IndexSearcher indexSearcher = new IndexSearcher(w.getReader()); Index: lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java =================================================================== --- lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java (revision 1176728) +++ lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java (working copy) @@ -174,7 +174,7 @@ // field that is indexed (i.e. searchable), but don't tokenize // the field into separate words and don't index term frequency // or positional information: - Field pathField = new Field("path", StringField.TYPE_STORED, file.getPath()); + Field pathField = new Field("path", file.getPath(), StringField.TYPE_STORED); doc.add(pathField); // Add the last modified date of the file a field named "modified". Index: lucene/contrib/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java =================================================================== --- lucene/contrib/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (revision 1176728) +++ lucene/contrib/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (working copy) @@ -134,10 +134,10 @@ //parse row and create a document StringTokenizer st = new StringTokenizer(line, "\t"); Document doc = new Document(); - doc.add(new Field("location", textNoNorms, st.nextToken())); - doc.add(new Field("salary", textNoNorms, st.nextToken())); - doc.add(new Field("type", textNoNorms, st.nextToken())); - doc.add(new Field("description", textNoNorms, st.nextToken())); + doc.add(new Field("location", st.nextToken(), textNoNorms)); + doc.add(new Field("salary", st.nextToken(), textNoNorms)); + doc.add(new Field("type", st.nextToken(), textNoNorms)); + doc.add(new Field("description", st.nextToken(), textNoNorms)); writer.addDocument(doc); } line = br.readLine(); Index: lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java =================================================================== --- lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (revision 1176728) +++ lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (working copy) @@ -211,39 +211,39 @@ customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); //document.add(new Field("a", i + " Do you really want to go and live in that house all winter?", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS)); - document.add(new Field("a", customType, i + " Do you really want to go and live in that house all winter?")); + document.add(new Field("a", i + " Do you really want to go and live in that house all winter?", customType)); if (i > 0) { //document.add(new Field("b0", i + " All work and no play makes Jack a dull boy", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS)); - document.add(new Field("b0", customType, i + " All work and no play makes Jack a dull boy")); + document.add(new Field("b0", i + " All work and no play makes Jack a dull boy", customType)); //document.add(new Field("b1", i + " All work and no play makes Jack a dull boy", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO)); FieldType customType2 = new FieldType(TextField.TYPE_STORED); customType2.setTokenized(false); customType2.setOmitNorms(true); - document.add(new Field("b1", customType2, i + " All work and no play makes Jack a dull boy")); + document.add(new Field("b1", i + " All work and no play makes Jack a dull boy", customType2)); //document.add(new Field("b2", i + " All work and no play makes Jack a dull boy", Field.Store.NO, Field.Index.NOT_ANALYZED, Field.TermVector.NO)); FieldType customType3 = new FieldType(TextField.TYPE_UNSTORED); customType3.setTokenized(false); - document.add(new Field("b1", customType3, i + " All work and no play makes Jack a dull boy")); + document.add(new Field("b1", i + " All work and no play makes Jack a dull boy", customType3)); //document.add(new Field("b3", i + " All work and no play makes Jack a dull boy", Field.Store.YES, Field.Index.NO, Field.TermVector.NO)); FieldType customType4 = new FieldType(TextField.TYPE_STORED); customType4.setIndexed(false); customType4.setTokenized(false); - document.add(new Field("b1", customType4, i + " All work and no play makes Jack a dull boy")); + document.add(new Field("b1", i + " All work and no play makes Jack a dull boy", customType4)); if (i > 1) { //document.add(new Field("c", i + " Redrum redrum", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS)); - document.add(new Field("c", customType, i + " Redrum redrum")); + document.add(new Field("c", i + " Redrum redrum", customType)); if (i > 2) { //document.add(new Field("d", i + " Hello Danny, come and play with us... forever and ever. and ever.", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS)); - document.add(new Field("d", customType, i + " Hello Danny, come and play with us... forever and ever. and ever.")); + document.add(new Field("d", i + " Hello Danny, come and play with us... forever and ever. and ever.", customType)); if (i > 3) { //Field f = new Field("e", i + " Heres Johnny!", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS); //f.setOmitNorms(true); FieldType customType5 = new FieldType(TextField.TYPE_UNSTORED); customType5.setOmitNorms(true); - Field f = new Field("e", customType5, i + " Heres Johnny!"); + Field f = new Field("e", i + " Heres Johnny!", customType5); document.add(f); if (i > 4) { final List tokens = new ArrayList(2); Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java =================================================================== --- lucene/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java (revision 1176728) +++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestIndexSplitter.java (working copy) @@ -113,10 +113,10 @@ Directory fsDir = newFSDirectory(indexPath); IndexWriter indexWriter = new IndexWriter(fsDir, iwConfig); Document doc = new Document(); - doc.add(new Field("content", StringField.TYPE_STORED, "doc 1")); + doc.add(new Field("content", "doc 1", StringField.TYPE_STORED)); indexWriter.addDocument(doc); doc = new Document(); - doc.add(new Field("content", StringField.TYPE_STORED, "doc 2")); + doc.add(new Field("content", "doc 2", StringField.TYPE_STORED)); indexWriter.addDocument(doc); indexWriter.close(); fsDir.close(); Index: lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java =================================================================== --- lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java (revision 1176728) +++ lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java (working copy) @@ -90,7 +90,7 @@ ft.setStoreTermVectors(fieldInfo.storeTermVector); ft.setStoreTermVectorOffsets(fieldInfo.storeOffsetWithTermVector); ft.setStoreTermVectorPositions(fieldInfo.storePositionWithTermVector); - doc.add(new Field(fieldInfo.name, ft, new String(b, "UTF-8"))); + doc.add(new Field(fieldInfo.name, new String(b, "UTF-8"), ft)); return accept != FieldSelectorResult.LOAD; case LAZY_LOAD: case LATENT: Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java =================================================================== --- lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (revision 1176728) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (working copy) @@ -64,7 +64,7 @@ customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); - document.add(new Field(FIELD, customType, new TokenStreamConcurrent())); + document.add(new Field(FIELD, new TokenStreamConcurrent(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); @@ -112,7 +112,7 @@ customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); - document.add(new Field(FIELD, customType, new TokenStreamConcurrent())); + document.add(new Field(FIELD, new TokenStreamConcurrent(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); @@ -187,7 +187,7 @@ customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); - document.add(new Field(FIELD, customType, new TokenStreamSparse())); + document.add(new Field(FIELD, new TokenStreamSparse(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); @@ -233,7 +233,7 @@ FieldType customType = new FieldType(TextField.TYPE_STORED); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectors(true); - document.add(new Field(FIELD, customType, TEXT)); + document.add(new Field(FIELD, TEXT, customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); @@ -277,7 +277,7 @@ customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); - document.add(new Field(FIELD, customType, new TokenStreamSparse())); + document.add(new Field(FIELD, new TokenStreamSparse(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java =================================================================== --- lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (revision 1176728) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (working copy) @@ -109,7 +109,7 @@ FieldType customType = new FieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); - document.add(new Field(FIELD, customType, new TokenStreamOverlap())); + document.add(new Field(FIELD, new TokenStreamOverlap(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); @@ -158,7 +158,7 @@ customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); - document.add(new Field(FIELD, customType, new TokenStreamOverlap())); + document.add(new Field(FIELD, new TokenStreamOverlap(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); @@ -206,7 +206,7 @@ FieldType customType = new FieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); - document.add(new Field(FIELD, customType, new TokenStreamOverlap())); + document.add(new Field(FIELD, new TokenStreamOverlap(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); @@ -255,7 +255,7 @@ FieldType customType = new FieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); - document.add(new Field(FIELD, customType, new TokenStreamOverlap())); + document.add(new Field(FIELD, new TokenStreamOverlap(), customType)); indexWriter.addDocument(document); } finally { indexWriter.close(); Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java =================================================================== --- lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (revision 1176728) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (working copy) @@ -1625,7 +1625,7 @@ private Document doc( String f, String v ){ Document doc = new Document(); - doc.add( new Field( f, TextField.TYPE_STORED, v)); + doc.add( new Field( f, v, TextField.TYPE_STORED)); return doc; } @@ -1776,7 +1776,7 @@ private void addDoc(IndexWriter writer, String text) throws IOException { Document d = new Document(); - Field f = new Field(FIELD_NAME, TextField.TYPE_STORED, text); + Field f = new Field(FIELD_NAME, text, TextField.TYPE_STORED); d.add(f); writer.addDocument(d); Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java =================================================================== --- lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java (revision 1176728) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java (working copy) @@ -359,7 +359,7 @@ customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); for( String value: values ) { - doc.add( new Field( F, customType, value ) ); + doc.add( new Field( F, value, customType) ); } writer.addDocument( doc ); writer.close(); @@ -377,7 +377,7 @@ customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); for( String value: values ) { - doc.add( new Field( F, customType, value )); + doc.add( new Field( F, value, customType)); //doc.add( new Field( F, value, Store.YES, Index.NOT_ANALYZED, TermVector.WITH_POSITIONS_OFFSETS ) ); } writer.addDocument( doc ); Index: lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java =================================================================== --- lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java (revision 1176728) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java (working copy) @@ -142,7 +142,7 @@ customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); - doc.add( new Field( F, customType, "aaa" ) ); + doc.add( new Field( F, "aaa", customType) ); //doc.add( new Field( F, "aaa", Store.NO, Index.ANALYZED, TermVector.WITH_POSITIONS_OFFSETS ) ); writer.addDocument( doc ); writer.close(); Index: lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java =================================================================== --- lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java (revision 1176728) +++ lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java (working copy) @@ -133,7 +133,7 @@ ft.setStoreTermVectors(fieldInfo.storeTermVector); ft.setStoreTermVectorOffsets(fieldInfo.storeOffsetWithTermVector); ft.setStoreTermVectorPositions(fieldInfo.storePositionWithTermVector); - fields.add(new Field(fieldInfo.name, ft, new String(b, "UTF-8"))); + fields.add(new Field(fieldInfo.name, new String(b, "UTF-8"), ft)); } else { in.seek(in.getFilePointer() + numUTF8Bytes); } Index: lucene/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java (revision 1176728) +++ lucene/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java (working copy) @@ -162,7 +162,7 @@ Document doc = new Document(); FieldType customType = new FieldType(TextField.TYPE_UNSTORED); customType.setOmitNorms(true); - Field f = new Field("f", customType, docText); + Field f = new Field("f", docText, customType); doc.add(f); return doc; } @@ -237,7 +237,7 @@ RandomIndexWriter iw = new RandomIndexWriter(random, dir); FieldType customType = new FieldType(TextField.TYPE_UNSTORED); customType.setOmitNorms(true); - Field f = new Field("lyrics", customType, ""); + Field f = new Field("lyrics", "", customType); Document doc = new Document(); doc.add(f); f.setValue("drug drug"); Index: lucene/src/test/org/apache/lucene/search/TestSort.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSort.java (revision 1176728) +++ lucene/src/test/org/apache/lucene/search/TestSort.java (working copy) @@ -132,7 +132,7 @@ for (int i=0; i e : super.getSnapshots().entrySet()) { - d.add(new Field(e.getKey(), ft, e.getValue())); + d.add(new Field(e.getKey(), e.getValue(), ft)); } if (id != null) { - d.add(new Field(id, ft, segment)); + d.add(new Field(id, segment, ft)); } writer.addDocument(d); writer.commit(); Index: lucene/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java =================================================================== --- lucene/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java (revision 1176728) +++ lucene/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java (working copy) @@ -82,8 +82,8 @@ ft.setOmitNorms(fieldInfo.omitNorms); ft.setIndexOptions(fieldInfo.indexOptions); doc.add(new Field(fieldInfo.name, - ft, - new String(b, "UTF-8"))); + new String(b, "UTF-8"), ft + )); } else { in.seek(in.getFilePointer() + numUTF8Bytes); } Index: lucene/src/java/org/apache/lucene/document/Field.java =================================================================== --- lucene/src/java/org/apache/lucene/document/Field.java (revision 1176728) +++ lucene/src/java/org/apache/lucene/document/Field.java (working copy) @@ -60,7 +60,7 @@ this.type = type; } - public Field(String name, IndexableFieldType type, Reader reader) { + public Field(String name, Reader reader, IndexableFieldType type) { if (name == null) { throw new NullPointerException("name cannot be null"); } @@ -76,7 +76,7 @@ this.type = type; } - public Field(String name, IndexableFieldType type, TokenStream tokenStream) { + public Field(String name, TokenStream tokenStream, IndexableFieldType type) { if (name == null) { throw new NullPointerException("name cannot be null"); } @@ -93,15 +93,15 @@ this.type = type; } - public Field(String name, IndexableFieldType type, byte[] value) { - this(name, type, value, 0, value.length); + public Field(String name, byte[] value, IndexableFieldType type) { + this(name, value, 0, value.length, type); } - public Field(String name, IndexableFieldType type, byte[] value, int offset, int length) { - this(name, type, new BytesRef(value, offset, length)); + public Field(String name, byte[] value, int offset, int length, IndexableFieldType type) { + this(name, new BytesRef(value, offset, length), type); } - public Field(String name, IndexableFieldType type, BytesRef bytes) { + public Field(String name, BytesRef bytes, IndexableFieldType type) { if (type.indexed() && !type.tokenized()) { throw new IllegalArgumentException("Non-tokenized fields must use String values"); } @@ -111,7 +111,7 @@ this.name = name; } - public Field(String name, IndexableFieldType type, String value) { + public Field(String name, String value, IndexableFieldType type) { if (name == null) { throw new IllegalArgumentException("name cannot be null"); } Index: lucene/src/java/org/apache/lucene/document/BinaryField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/BinaryField.java (revision 1176728) +++ lucene/src/java/org/apache/lucene/document/BinaryField.java (working copy) @@ -31,16 +31,16 @@ /** Creates a new BinaryField */ public BinaryField(String name, byte[] value) { - super(name, BinaryField.TYPE_STORED, value); + super(name, value, BinaryField.TYPE_STORED); } /** Creates a new BinaryField */ public BinaryField(String name, byte[] value, int offset, int length) { - super(name, BinaryField.TYPE_STORED, value, offset, length); + super(name, value, offset, length, BinaryField.TYPE_STORED); } /** Creates a new BinaryField */ public BinaryField(String name, BytesRef bytes) { - super(name, BinaryField.TYPE_STORED, bytes); + super(name, bytes, BinaryField.TYPE_STORED); } } Index: lucene/src/java/org/apache/lucene/document/TextField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/TextField.java (revision 1176728) +++ lucene/src/java/org/apache/lucene/document/TextField.java (working copy) @@ -50,16 +50,16 @@ /** Creates a new un-stored TextField */ public TextField(String name, Reader reader) { - super(name, TextField.TYPE_UNSTORED, reader); + super(name, reader, TextField.TYPE_UNSTORED); } /** Creates a new un-stored TextField */ public TextField(String name, String value) { - super(name, TextField.TYPE_UNSTORED, value); + super(name, value, TextField.TYPE_UNSTORED); } /** Creates a new un-stored TextField */ public TextField(String name, TokenStream stream) { - super(name, TextField.TYPE_UNSTORED, stream); + super(name, stream, TextField.TYPE_UNSTORED); } } Index: lucene/src/java/org/apache/lucene/document/StringField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/StringField.java (revision 1176728) +++ lucene/src/java/org/apache/lucene/document/StringField.java (working copy) @@ -54,7 +54,7 @@ /** Creates a new un-stored StringField */ public StringField(String name, String value) { - super(name, TYPE_UNSTORED, value); + super(name, value, TYPE_UNSTORED); } @Override Index: lucene/src/test-framework/org/apache/lucene/analysis/CollationTestBase.java =================================================================== --- lucene/src/test-framework/org/apache/lucene/analysis/CollationTestBase.java (revision 1176728) +++ lucene/src/test-framework/org/apache/lucene/analysis/CollationTestBase.java (working copy) @@ -81,8 +81,8 @@ IndexWriter writer = new IndexWriter(ramDir, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); - doc.add(new Field("content", TextField.TYPE_STORED, "\u0633\u0627\u0628")); - doc.add(new Field("body", StringField.TYPE_STORED, "body")); + doc.add(new Field("content", "\u0633\u0627\u0628", TextField.TYPE_STORED)); + doc.add(new Field("body", "body", StringField.TYPE_STORED)); writer.addDocument(doc); writer.close(); IndexSearcher searcher = new IndexSearcher(ramDir, true); @@ -116,7 +116,7 @@ // orders the U+0698 character before the U+0633 character, so the single // index Term below should NOT be returned by a TermRangeQuery with a Farsi // Collator (or an Arabic one for the case when Farsi is not supported). - doc.add(new Field("content", TextField.TYPE_STORED, "\u0633\u0627\u0628")); + doc.add(new Field("content", "\u0633\u0627\u0628", TextField.TYPE_STORED)); writer.addDocument(doc); writer.close(); IndexSearcher searcher = new IndexSearcher(ramDir, true); @@ -138,8 +138,8 @@ IndexWriter writer = new IndexWriter(farsiIndex, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzer)); Document doc = new Document(); - doc.add(new Field("content", TextField.TYPE_STORED, "\u0633\u0627\u0628")); - doc.add(new Field("body", StringField.TYPE_STORED, "body")); + doc.add(new Field("content", "\u0633\u0627\u0628", TextField.TYPE_STORED)); + doc.add(new Field("body", "body", StringField.TYPE_STORED)); writer.addDocument(doc); writer.close(); @@ -204,7 +204,7 @@ for (int i = 0 ; i < sortData.length ; ++i) { Document doc = new Document(); - doc.add(new Field("tracer", customType, sortData[i][0])); + doc.add(new Field("tracer", sortData[i][0], customType)); doc.add(new TextField("contents", sortData[i][1])); if (sortData[i][2] != null) doc.add(new TextField("US", usAnalyzer.tokenStream("US", new StringReader(sortData[i][2])))); Index: lucene/src/test-framework/org/apache/lucene/index/DocHelper.java =================================================================== --- lucene/src/test-framework/org/apache/lucene/index/DocHelper.java (revision 1176728) +++ lucene/src/test-framework/org/apache/lucene/index/DocHelper.java (working copy) @@ -46,7 +46,7 @@ public static Field textField1; static { customType = new FieldType(TextField.TYPE_STORED); - textField1 = new Field(TEXT_FIELD_1_KEY, customType, FIELD_1_TEXT); + textField1 = new Field(TEXT_FIELD_1_KEY, FIELD_1_TEXT, customType); } public static final FieldType customType2; @@ -60,7 +60,7 @@ customType2.setStoreTermVectors(true); customType2.setStoreTermVectorPositions(true); customType2.setStoreTermVectorOffsets(true); - textField2 = new Field(TEXT_FIELD_2_KEY, customType2, FIELD_2_TEXT); + textField2 = new Field(TEXT_FIELD_2_KEY, FIELD_2_TEXT, customType2); } public static final FieldType customType3; @@ -71,14 +71,14 @@ static { customType3 = new FieldType(TextField.TYPE_STORED); customType3.setOmitNorms(true); - textField3 = new Field(TEXT_FIELD_3_KEY, customType3, FIELD_3_TEXT); + textField3 = new Field(TEXT_FIELD_3_KEY, FIELD_3_TEXT, customType3); } public static final String KEYWORD_TEXT = "Keyword"; public static final String KEYWORD_FIELD_KEY = "keyField"; public static Field keyField; static { - keyField = new Field(KEYWORD_FIELD_KEY, StringField.TYPE_STORED, KEYWORD_TEXT); + keyField = new Field(KEYWORD_FIELD_KEY, KEYWORD_TEXT, StringField.TYPE_STORED); } public static final FieldType customType5; @@ -89,7 +89,7 @@ customType5 = new FieldType(TextField.TYPE_STORED); customType5.setOmitNorms(true); customType5.setTokenized(false); - noNormsField = new Field(NO_NORMS_KEY, customType5, NO_NORMS_TEXT); + noNormsField = new Field(NO_NORMS_KEY, NO_NORMS_TEXT, customType5); } public static final FieldType customType6; @@ -99,7 +99,7 @@ static { customType6 = new FieldType(TextField.TYPE_STORED); customType6.setIndexOptions(IndexOptions.DOCS_ONLY); - noTFField = new Field(NO_TF_KEY, customType6, NO_TF_TEXT); + noTFField = new Field(NO_TF_KEY, NO_TF_TEXT, customType6); } public static final FieldType customType7; @@ -109,13 +109,13 @@ static { customType7 = new FieldType(); customType7.setStored(true); - unIndField = new Field(UNINDEXED_FIELD_KEY, customType7, UNINDEXED_FIELD_TEXT); + unIndField = new Field(UNINDEXED_FIELD_KEY, UNINDEXED_FIELD_TEXT, customType7); } public static final String UNSTORED_1_FIELD_TEXT = "unstored field text"; public static final String UNSTORED_FIELD_1_KEY = "unStoredField1"; - public static Field unStoredField1 = new Field(UNSTORED_FIELD_1_KEY, TextField.TYPE_UNSTORED, UNSTORED_1_FIELD_TEXT); + public static Field unStoredField1 = new Field(UNSTORED_FIELD_1_KEY, UNSTORED_1_FIELD_TEXT, TextField.TYPE_UNSTORED); public static final FieldType customType8; public static final String UNSTORED_2_FIELD_TEXT = "unstored field text"; @@ -124,7 +124,7 @@ static { customType8 = new FieldType(TextField.TYPE_UNSTORED); customType8.setStoreTermVectors(true); - unStoredField2 = new Field(UNSTORED_FIELD_2_KEY, customType8, UNSTORED_2_FIELD_TEXT); + unStoredField2 = new Field(UNSTORED_FIELD_2_KEY, UNSTORED_2_FIELD_TEXT, customType8); } public static final String LAZY_FIELD_BINARY_KEY = "lazyFieldBinary"; @@ -133,7 +133,7 @@ public static final String LAZY_FIELD_KEY = "lazyField"; public static final String LAZY_FIELD_TEXT = "These are some field bytes"; - public static Field lazyField = new Field(LAZY_FIELD_KEY, customType, LAZY_FIELD_TEXT); + public static Field lazyField = new Field(LAZY_FIELD_KEY, LAZY_FIELD_TEXT, customType); public static final String LARGE_LAZY_FIELD_KEY = "largeLazyField"; public static String LARGE_LAZY_FIELD_TEXT; @@ -142,13 +142,13 @@ //From Issue 509 public static final String FIELD_UTF1_TEXT = "field one \u4e00text"; public static final String TEXT_FIELD_UTF1_KEY = "textField1Utf8"; - public static Field textUtfField1 = new Field(TEXT_FIELD_UTF1_KEY, customType, FIELD_UTF1_TEXT); + public static Field textUtfField1 = new Field(TEXT_FIELD_UTF1_KEY, FIELD_UTF1_TEXT, customType); public static final String FIELD_UTF2_TEXT = "field field field \u4e00two text"; //Fields will be lexicographically sorted. So, the order is: field, text, two public static final int [] FIELD_UTF2_FREQS = {3, 1, 1}; public static final String TEXT_FIELD_UTF2_KEY = "textField2Utf8"; - public static Field textUtfField2 = new Field(TEXT_FIELD_UTF2_KEY, customType2, FIELD_UTF2_TEXT); + public static Field textUtfField2 = new Field(TEXT_FIELD_UTF2_KEY, FIELD_UTF2_TEXT, customType2); @@ -200,7 +200,7 @@ lazyFieldBinary = new BinaryField(LAZY_FIELD_BINARY_KEY, LAZY_FIELD_BINARY_BYTES); fields[fields.length - 2] = lazyFieldBinary; LARGE_LAZY_FIELD_TEXT = buffer.toString(); - largeLazyField = new Field(LARGE_LAZY_FIELD_KEY, customType, LARGE_LAZY_FIELD_TEXT); + largeLazyField = new Field(LARGE_LAZY_FIELD_KEY, LARGE_LAZY_FIELD_TEXT, customType); fields[fields.length - 1] = largeLazyField; for (int i=0; i