Index: solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java =================================================================== --- solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java (revision 1163903) +++ solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java (working copy) @@ -363,27 +363,27 @@ f = ischema.getField("test_basictv"); luf = f.createField("test", 0f); assertTrue(f.storeTermVector()); - assertTrue(luf.storeTermVectors()); + assertTrue(luf.fieldType().storeTermVectors()); f = ischema.getField("test_notv"); luf = f.createField("test", 0f); assertTrue(!f.storeTermVector()); - assertTrue(!luf.storeTermVectors()); + assertTrue(!luf.fieldType().storeTermVectors()); f = ischema.getField("test_postv"); luf = f.createField("test", 0f); assertTrue(f.storeTermVector() && f.storeTermPositions()); - assertTrue(luf.storeTermVectorPositions()); + assertTrue(luf.fieldType().storeTermVectorPositions()); f = ischema.getField("test_offtv"); luf = f.createField("test", 0f); assertTrue(f.storeTermVector() && f.storeTermOffsets()); - assertTrue(luf.storeTermVectorOffsets()); + assertTrue(luf.fieldType().storeTermVectorOffsets()); f = ischema.getField("test_posofftv"); luf = f.createField("test", 0f); assertTrue(f.storeTermVector() && f.storeTermPositions() && f.storeTermOffsets()); - assertTrue(luf.storeTermVectorOffsets() && luf.storeTermVectorPositions()); + assertTrue(luf.fieldType().storeTermVectorOffsets() && luf.fieldType().storeTermVectorPositions()); } Index: solr/core/src/java/org/apache/solr/schema/TrieField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/TrieField.java (revision 1163903) +++ solr/core/src/java/org/apache/solr/schema/TrieField.java (working copy) @@ -16,6 +16,7 @@ */ package org.apache.solr.schema; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.NumericField; import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.*; @@ -482,7 +483,7 @@ return null; } - org.apache.lucene.document.FieldType ft = new org.apache.lucene.document.FieldType(); + CoreFieldType ft = new CoreFieldType(); ft.setStored(stored); ft.setTokenized(true); ft.setIndexed(indexed); Index: solr/core/src/java/org/apache/solr/schema/PointType.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/PointType.java (revision 1163903) +++ solr/core/src/java/org/apache/solr/schema/PointType.java (working copy) @@ -17,6 +17,7 @@ package org.apache.solr.schema; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.queries.function.valuesource.VectorValueSource; import org.apache.lucene.index.IndexableField; @@ -87,7 +88,7 @@ if (field.stored()) { String storedVal = externalVal; // normalize or not? - org.apache.lucene.document.FieldType customType = new org.apache.lucene.document.FieldType(); + CoreFieldType customType = new CoreFieldType(); customType.setStored(true); f[f.length - 1] = createField(field.getName(), storedVal, customType, boost); } Index: solr/core/src/java/org/apache/solr/schema/LatLonType.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/LatLonType.java (revision 1163903) +++ solr/core/src/java/org/apache/solr/schema/LatLonType.java (working copy) @@ -16,7 +16,7 @@ * limitations under the License. */ -import org.apache.lucene.document.FieldType; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader.AtomicReaderContext; @@ -75,7 +75,7 @@ } if (field.stored()) { - FieldType customType = new FieldType(); + CoreFieldType customType = new CoreFieldType(); customType.setStored(true); f[f.length - 1] = createField(field.getName(), externalVal, customType, boost); } Index: solr/core/src/java/org/apache/solr/schema/FieldType.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/FieldType.java (revision 1163903) +++ solr/core/src/java/org/apache/solr/schema/FieldType.java (working copy) @@ -21,6 +21,7 @@ import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Field; import org.apache.lucene.index.FieldInfo.IndexOptions; import org.apache.lucene.index.IndexableField; @@ -250,7 +251,7 @@ } if (val==null) return null; - org.apache.lucene.document.FieldType newType = new org.apache.lucene.document.FieldType(); + CoreFieldType newType = new CoreFieldType(); newType.setIndexed(field.indexed()); newType.setTokenized(field.isTokenized()); newType.setStored(field.stored()); @@ -268,11 +269,11 @@ * Fields per SchemaField * @param name The name of the field * @param val The _internal_ value to index - * @param type {@link org.apache.lucene.document.FieldType} + * @param type {@link org.apache.lucene.document.CoreFieldType} * @param boost The boost value * @return the {@link org.apache.lucene.index.IndexableField}. */ - protected IndexableField createField(String name, String val, org.apache.lucene.document.FieldType type, float boost){ + protected IndexableField createField(String name, String val, CoreFieldType type, float boost){ Field f = new Field(name, type, val); f.setBoost(boost); return f; Index: solr/core/src/java/org/apache/solr/update/DocumentBuilder.java =================================================================== --- solr/core/src/java/org/apache/solr/update/DocumentBuilder.java (revision 1163903) +++ solr/core/src/java/org/apache/solr/update/DocumentBuilder.java (working copy) @@ -336,7 +336,7 @@ public SolrDocument loadStoredFields( SolrDocument doc, Document luceneDoc ) { for( IndexableField field : luceneDoc) { - if( field.stored() ) { + if( field.fieldType().stored() ) { SchemaField sf = schema.getField( field.name() ); if( !schema.isCopyFieldTarget( sf ) ) { doc.addField( field.name(), sf.getType().toObject( field ) ); Index: solr/core/src/java/org/apache/solr/request/SimpleFacets.java =================================================================== --- solr/core/src/java/org/apache/solr/request/SimpleFacets.java (revision 1163903) +++ solr/core/src/java/org/apache/solr/request/SimpleFacets.java (working copy) @@ -40,6 +40,7 @@ import org.apache.solr.common.util.StrUtils; import org.apache.solr.core.SolrCore; import org.apache.solr.schema.*; +import org.apache.solr.schema.FieldType; import org.apache.solr.search.*; import org.apache.solr.util.BoundedTreeSet; import org.apache.solr.util.DateMathParser; Index: solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java =================================================================== --- solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (revision 1163903) +++ solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (working copy) @@ -168,14 +168,14 @@ private static String getFieldFlags( IndexableField f ) { StringBuilder flags = new StringBuilder(); - flags.append( (f != null && f.indexed()) ? FieldFlag.INDEXED.getAbbreviation() : '-' ); - flags.append( (f != null && f.tokenized()) ? FieldFlag.TOKENIZED.getAbbreviation() : '-' ); - flags.append( (f != null && f.stored()) ? FieldFlag.STORED.getAbbreviation() : '-' ); + flags.append( (f != null && f.fieldType().indexed()) ? FieldFlag.INDEXED.getAbbreviation() : '-' ); + flags.append( (f != null && f.fieldType().tokenized()) ? FieldFlag.TOKENIZED.getAbbreviation() : '-' ); + flags.append( (f != null && f.fieldType().stored()) ? FieldFlag.STORED.getAbbreviation() : '-' ); flags.append( (false) ? FieldFlag.MULTI_VALUED.getAbbreviation() : '-' ); // SchemaField Specific - flags.append( (f != null && f.storeTermVectors()) ? FieldFlag.TERM_VECTOR_STORED.getAbbreviation() : '-' ); - flags.append( (f != null && f.storeTermVectorOffsets()) ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-' ); - flags.append( (f != null && f.storeTermVectorPositions()) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation() : '-' ); - flags.append( (f != null && f.omitNorms()) ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-' ); + flags.append( (f != null && f.fieldType().storeTermVectors()) ? FieldFlag.TERM_VECTOR_STORED.getAbbreviation() : '-' ); + flags.append( (f != null && f.fieldType().storeTermVectorOffsets()) ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-' ); + flags.append( (f != null && f.fieldType().storeTermVectorPositions()) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation() : '-' ); + flags.append( (f != null && f.fieldType().omitNorms()) ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-' ); flags.append( (f != null && f.getClass().getSimpleName().equals("LazyField")) ? FieldFlag.LAZY.getAbbreviation() : '-' ); flags.append( (f != null && f.binaryValue()!=null) ? FieldFlag.BINARY.getAbbreviation() : '-' ); flags.append( (false) ? FieldFlag.SORT_MISSING_FIRST.getAbbreviation() : '-' ); // SchemaField Specific @@ -264,7 +264,7 @@ f.add( "docFreq", t.text()==null ? 0 : reader.docFreq( t ) ); // this can be 0 for non-indexed fields // If we have a term vector, return that - if( field.storeTermVectors() ) { + if( field.fieldType().storeTermVectors() ) { try { TermFreqVector v = reader.getTermFreqVector( docId, field.name() ); if( v != null ) { Index: modules/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java =================================================================== --- modules/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java (revision 1163903) +++ modules/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java (working copy) @@ -23,9 +23,9 @@ import java.util.Iterator; import java.util.List; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldType; import org.apache.lucene.index.FieldInfo.IndexOptions; import org.apache.lucene.document.StringField; import org.apache.lucene.index.IndexReader; @@ -619,7 +619,7 @@ String end = null; for (int i = 0; i < len - ng + 1; i++) { String gram = text.substring(i, i + ng); - FieldType ft = new FieldType(StringField.TYPE_UNSTORED); + CoreFieldType ft = new CoreFieldType(StringField.TYPE_UNSTORED); ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS); Field ngramField = new Field(key, ft, gram); // spellchecker does not use positional queries, but we want freqs Index: modules/facet/src/test/org/apache/lucene/facet/util/TestScoredDocIDsUtils.java =================================================================== --- modules/facet/src/test/org/apache/lucene/facet/util/TestScoredDocIDsUtils.java (revision 1163903) +++ modules/facet/src/test/org/apache/lucene/facet/util/TestScoredDocIDsUtils.java (working copy) @@ -5,9 +5,9 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.analysis.MockTokenizer; +import org.apache.lucene.document.CoreFieldType; 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.MultiFields; @@ -208,7 +208,7 @@ doc.add(deletionMark); // Add a special field for docs that are marked for deletion. Later we // assert that those docs are not returned by all-scored-doc-IDs. - FieldType ft = new FieldType(); + CoreFieldType ft = new CoreFieldType(); ft.setStored(true); doc.add(new Field("del", ft, Integer.toString(docNum))); } Index: modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java =================================================================== --- modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java (revision 1163903) +++ modules/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java (working copy) @@ -8,9 +8,9 @@ import java.util.Map.Entry; import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.document.CoreFieldType; 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.DocumentBuilder; @@ -185,7 +185,7 @@ // Finally creating a suitable field with stream and adding it to a // master field-list, used during the build process (see // super.build()) - FieldType ft = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType ft = new CoreFieldType(TextField.TYPE_UNSTORED); ft.setOmitNorms(true); fieldList.add(new Field(e.getKey(), ft, stream)); } Index: modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java =================================================================== --- modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java (revision 1163903) +++ modules/facet/src/java/org/apache/lucene/facet/taxonomy/lucene/LuceneTaxonomyWriter.java (working copy) @@ -15,11 +15,7 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StringField; -import org.apache.lucene.document.TextField; +import org.apache.lucene.document.*; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.IndexReader; @@ -179,7 +175,7 @@ openLuceneIndex(directory, openMode); reader = null; - FieldType ft = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType ft = new CoreFieldType(TextField.TYPE_UNSTORED); ft.setOmitNorms(true); parentStreamField = new Field(Consts.FIELD_PAYLOADS, ft, parentStream); fullPathField = new Field(Consts.FULL, StringField.TYPE_STORED, ""); Index: modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java =================================================================== --- modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java (revision 1163903) +++ modules/analysis/common/src/test/org/apache/lucene/analysis/sinks/TestTeeSinkTokenFilter.java (working copy) @@ -25,9 +25,9 @@ import org.apache.lucene.analysis.standard.StandardTokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; +import org.apache.lucene.document.CoreFieldType; 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.IndexWriter; @@ -89,7 +89,7 @@ Document doc = new Document(); TeeSinkTokenFilter tee = new TeeSinkTokenFilter(analyzer.tokenStream("field", new StringReader("abcd "))); TokenStream sink = tee.newSinkTokenStream(); - FieldType ft = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType ft = new CoreFieldType(TextField.TYPE_UNSTORED); ft.setStoreTermVectors(true); ft.setStoreTermVectorOffsets(true); ft.setStoreTermVectorPositions(true); Index: modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/DocMakerTest.java =================================================================== --- modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/DocMakerTest.java (revision 1163903) +++ modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/DocMakerTest.java (working copy) @@ -136,28 +136,28 @@ // Don't set anything, use the defaults doc = createTestNormsDocument(false, false, false, false); - assertTrue(doc.getField(DocMaker.TITLE_FIELD).omitNorms()); - assertFalse(doc.getField(DocMaker.BODY_FIELD).omitNorms()); + assertTrue(doc.getField(DocMaker.TITLE_FIELD).fieldType().omitNorms()); + assertFalse(doc.getField(DocMaker.BODY_FIELD).fieldType().omitNorms()); // Set norms to false doc = createTestNormsDocument(true, false, false, false); - assertTrue(doc.getField(DocMaker.TITLE_FIELD).omitNorms()); - assertFalse(doc.getField(DocMaker.BODY_FIELD).omitNorms()); + assertTrue(doc.getField(DocMaker.TITLE_FIELD).fieldType().omitNorms()); + assertFalse(doc.getField(DocMaker.BODY_FIELD).fieldType().omitNorms()); // Set norms to true doc = createTestNormsDocument(true, true, false, false); - assertFalse(doc.getField(DocMaker.TITLE_FIELD).omitNorms()); - assertFalse(doc.getField(DocMaker.BODY_FIELD).omitNorms()); + assertFalse(doc.getField(DocMaker.TITLE_FIELD).fieldType().omitNorms()); + assertFalse(doc.getField(DocMaker.BODY_FIELD).fieldType().omitNorms()); // Set body norms to false doc = createTestNormsDocument(false, false, true, false); - assertTrue(doc.getField(DocMaker.TITLE_FIELD).omitNorms()); - assertTrue(doc.getField(DocMaker.BODY_FIELD).omitNorms()); + assertTrue(doc.getField(DocMaker.TITLE_FIELD).fieldType().omitNorms()); + assertTrue(doc.getField(DocMaker.BODY_FIELD).fieldType().omitNorms()); // Set body norms to true doc = createTestNormsDocument(false, false, true, true); - assertTrue(doc.getField(DocMaker.TITLE_FIELD).omitNorms()); - assertFalse(doc.getField(DocMaker.BODY_FIELD).omitNorms()); + assertTrue(doc.getField(DocMaker.TITLE_FIELD).fieldType().omitNorms()); + assertFalse(doc.getField(DocMaker.BODY_FIELD).fieldType().omitNorms()); } } Index: modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java =================================================================== --- modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java (revision 1163903) +++ modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java (working copy) @@ -69,7 +69,7 @@ Analyzer analyzer = getRunData().getAnalyzer(); int tokenCount = 0; for(final IndexableField field : fields) { - if (!field.tokenized() || field instanceof NumericField) continue; + if (!field.fieldType().tokenized() || field instanceof NumericField) continue; final TokenStream stream; final TokenStream streamValue = field.tokenStreamValue(); Index: modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java =================================================================== --- modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (revision 1163903) +++ modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (working copy) @@ -32,12 +32,7 @@ import org.apache.lucene.benchmark.byTask.utils.Config; import org.apache.lucene.benchmark.byTask.utils.Format; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.NumericField; -import org.apache.lucene.document.StringField; -import org.apache.lucene.document.TextField; +import org.apache.lucene.document.*; /** * Creates {@link Document} objects. Uses a {@link ContentSource} to generate @@ -94,7 +89,7 @@ final Document doc; DocData docData = new DocData(); - public DocState(boolean reuseFields, FieldType ft, FieldType bodyFt) { + public DocState(boolean reuseFields, CoreFieldType ft, CoreFieldType bodyFt) { this.reuseFields = reuseFields; @@ -125,7 +120,7 @@ * reuseFields was set to true, then it attempts to reuse a * Field instance. If such a field does not exist, it creates a new one. */ - Field getField(String name, FieldType ft) { + Field getField(String name, CoreFieldType ft) { if (!reuseFields) { return new Field(name, ft, ""); } @@ -179,8 +174,8 @@ protected Config config; - protected FieldType valType; - protected FieldType bodyValType; + protected CoreFieldType valType; + protected CoreFieldType bodyValType; protected ContentSource source; protected boolean reuseFields; @@ -206,7 +201,7 @@ doc.getFields().clear(); // Set ID_FIELD - FieldType ft = new FieldType(valType); + CoreFieldType ft = new CoreFieldType(valType); ft.setIndexed(true); Field idField = ds.getField(ID_FIELD, ft); @@ -461,7 +456,7 @@ boolean termVecPositions = config.get("doc.term.vector.positions", false); boolean termVecOffsets = config.get("doc.term.vector.offsets", false); - valType = new FieldType(TextField.TYPE_UNSTORED); + valType = new CoreFieldType(TextField.TYPE_UNSTORED); valType.setStored(stored); valType.setTokenized(tokenized); valType.setOmitNorms(!norms); @@ -470,7 +465,7 @@ valType.setStoreTermVectorOffsets(termVecOffsets); valType.freeze(); - bodyValType = new FieldType(TextField.TYPE_UNSTORED); + bodyValType = new CoreFieldType(TextField.TYPE_UNSTORED); bodyValType.setStored(bodyStored); bodyValType.setTokenized(bodyTokenized); bodyValType.setOmitNorms(!bodyNorms); Index: modules/grouping/src/test/org/apache/lucene/search/grouping/TermAllGroupsCollectorTest.java =================================================================== --- modules/grouping/src/test/org/apache/lucene/search/grouping/TermAllGroupsCollectorTest.java (revision 1163903) +++ modules/grouping/src/test/org/apache/lucene/search/grouping/TermAllGroupsCollectorTest.java (working copy) @@ -18,9 +18,9 @@ */ import org.apache.lucene.analysis.MockAnalyzer; +import org.apache.lucene.document.CoreFieldType; 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.RandomIndexWriter; import org.apache.lucene.index.Term; @@ -34,7 +34,7 @@ public void testTotalGroupCount() throws Exception { final String groupField = "author"; - FieldType customType = new FieldType(); + CoreFieldType customType = new CoreFieldType(); customType.setStored(true); Directory dir = newDirectory(); Index: modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java =================================================================== --- modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (revision 1163903) +++ modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (working copy) @@ -21,13 +21,8 @@ import java.util.*; 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.NumericField; +import org.apache.lucene.document.*; import org.apache.lucene.index.FieldInfo.IndexOptions; -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; @@ -50,7 +45,7 @@ final String groupField = "author"; - FieldType customType = new FieldType(); + CoreFieldType customType = new CoreFieldType(); customType.setStored(true); Directory dir = newDirectory(); @@ -401,7 +396,7 @@ //System.out.println("TEST: doc content=" + groupValue.content + " group=" + (groupValue.group == null ? "null" : groupValue.group.utf8ToString()) + " sort1=" + groupValue.sort1.utf8ToString() + " id=" + groupValue.id); } // So we can pull filter marking last doc in block: - FieldType ft = new FieldType(StringField.TYPE_UNSTORED); + CoreFieldType ft = new CoreFieldType(StringField.TYPE_UNSTORED); ft.setIndexOptions(IndexOptions.DOCS_ONLY); ft.setOmitNorms(true); final Field groupEnd = newField("groupend", "x", ft); Index: modules/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java =================================================================== --- modules/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java (revision 1163903) +++ modules/queries/src/test/org/apache/lucene/queries/function/FunctionTestSetup.java (working copy) @@ -2,9 +2,9 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.MockAnalyzer; +import org.apache.lucene.document.CoreFieldType; 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.RandomIndexWriter; import org.apache.lucene.index.IndexWriterConfig; @@ -132,14 +132,14 @@ Field f; int scoreAndID = i + 1; - FieldType customType = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_STORED); customType.setTokenized(false); customType.setOmitNorms(true); f = newField(ID_FIELD, id2String(scoreAndID), customType); // for debug purposes d.add(f); - FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType2 = new CoreFieldType(TextField.TYPE_UNSTORED); customType2.setOmitNorms(true); f = newField(TEXT_FIELD, "text of doc" + scoreAndID + textLine(i), customType2); // for regular search d.add(f); 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 1163903) +++ lucene/contrib/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (working copy) @@ -33,9 +33,9 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; +import org.apache.lucene.document.CoreFieldType; 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.CorruptIndexException; import org.apache.lucene.index.IndexWriter; @@ -126,7 +126,7 @@ InputStream dataIn = getServletContext().getResourceAsStream("/WEB-INF/data.tsv"); BufferedReader br = new BufferedReader(new InputStreamReader(dataIn)); String line = br.readLine(); - final FieldType textNoNorms = new FieldType(TextField.TYPE_STORED); + final CoreFieldType textNoNorms = new CoreFieldType(TextField.TYPE_STORED); textNoNorms.setOmitNorms(true); while (line != null) { line = line.trim(); 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 1163903) +++ lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestIndicesEquals.java (working copy) @@ -27,9 +27,9 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; +import org.apache.lucene.document.CoreFieldType; 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.IndexWriter; @@ -206,7 +206,7 @@ private void assembleDocument(Document document, int i) { - FieldType customType = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_STORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); @@ -217,18 +217,18 @@ document.add(new Field("b0", customType, i + " All work and no play makes Jack a dull boy")); //document.add(new Field("b1", i + " All work and no play makes Jack a dull boy", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS, Field.TermVector.NO)); - FieldType customType2 = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType2 = new CoreFieldType(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("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); + CoreFieldType customType3 = new CoreFieldType(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("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); + CoreFieldType customType4 = new CoreFieldType(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")); @@ -241,7 +241,7 @@ 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); + CoreFieldType customType5 = new CoreFieldType(TextField.TYPE_UNSTORED); customType5.setOmitNorms(true); Field f = new Field("e", customType5, i + " Heres Johnny!"); document.add(f); Index: lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java =================================================================== --- lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (revision 1163903) +++ lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (working copy) @@ -484,28 +484,28 @@ // once fieldSettings, always fieldSettings. - if (field.omitNorms()) { + if (field.fieldType().omitNorms()) { fieldSetting.omitNorms = true; } - if (field.indexed() ) { + if (field.fieldType().indexed() ) { fieldSetting.indexed = true; } - if (field.tokenized()) { + if (field.fieldType().tokenized()) { fieldSetting.tokenized = true; } - if (field.stored()) { + if (field.fieldType().stored()) { fieldSetting.stored = true; } if (field.binaryValue() != null) { fieldSetting.isBinary = true; } - if (field.storeTermVectors()) { + if (field.fieldType().storeTermVectors()) { fieldSetting.storeTermVector = true; } - if (field.storeTermVectorPositions()) { + if (field.fieldType().storeTermVectorPositions()) { fieldSetting.storePositionWithTermVector = true; } - if (field.storeTermVectorOffsets()) { + if (field.fieldType().storeTermVectorOffsets()) { fieldSetting.storeOffsetWithTermVector = true; } } @@ -519,12 +519,12 @@ FieldSetting fieldSetting = fieldSettingsByFieldName.get(field.name()); - if (field.indexed()) { + if (field.fieldType().indexed()) { LinkedList tokens = new LinkedList(); tokensByField.put(field, tokens); - if (field.tokenized()) { + if (field.fieldType().tokenized()) { final TokenStream tokenStream; // todo readerValue(), binaryValue() if (field.tokenStreamValue() != null) { @@ -564,7 +564,7 @@ } } - if (!field.stored()) { + if (!field.fieldType().stored()) { //it.remove(); } } @@ -610,7 +610,7 @@ termDocumentInformationFactory.payloads.add(null); } - if (eField_Tokens.getKey().storeTermVectorOffsets()) { + if (eField_Tokens.getKey().fieldType().storeTermVectorOffsets()) { termDocumentInformationFactory.termOffsets.add(new TermVectorOffsetInfo(fieldSetting.offset + token.startOffset(), fieldSetting.offset + token.endOffset())); lastOffset = fieldSetting.offset + token.endOffset(); @@ -619,7 +619,7 @@ } - if (eField_Tokens.getKey().storeTermVectorOffsets()) { + if (eField_Tokens.getKey().fieldType().storeTermVectorOffsets()) { fieldSetting.offset = lastOffset + 1; } Index: lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java =================================================================== --- lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (revision 1163903) +++ lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (working copy) @@ -199,7 +199,7 @@ documentsByNumber[i] = document; for (IndexableField field : document.getDocument()) { if (fields == null || fields.contains(field.name())) { - if (field.storeTermVectors()) { + if (field.fieldType().storeTermVectors()) { if (document.getVectorSpace() == null) { document.setVectorSpace(new HashMap>()); } @@ -291,7 +291,7 @@ continue; // deleted } for (IndexableField field : document.getDocument()) { - if (field.storeTermVectors() && field.storeTermVectorOffsets()) { + if (field.fieldType().storeTermVectors() && field.fieldType().storeTermVectorOffsets()) { TermPositionVector termPositionVector = (TermPositionVector) sourceIndexReader.getTermFreqVector(document.getDocumentNumber(), field.name()); if (termPositionVector != null) { for (int i = 0; i < termPositionVector.getTerms().length; i++) { Index: lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java =================================================================== --- lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java (revision 1163903) +++ lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java (working copy) @@ -21,8 +21,8 @@ import java.util.Random; import org.apache.lucene.analysis.MockAnalyzer; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Document; -import org.apache.lucene.document.FieldType; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DocsEnum; import org.apache.lucene.index.Fields; @@ -140,7 +140,7 @@ ((TieredMergePolicy)cfg.getMergePolicy()).setUseCompoundFile(false); IndexWriter writer = new IndexWriter(dir, cfg); Document doc = new Document(); - FieldType storedTextType = new FieldType(TextField.TYPE_STORED); + CoreFieldType storedTextType = new CoreFieldType(TextField.TYPE_STORED); storedTextType.setStoreTermVectors(true); storedTextType.setStoreTermVectorPositions(true); storedTextType.setStoreTermVectorOffsets(true); Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java =================================================================== --- lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java (revision 1163903) +++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribIndexReader.java (working copy) @@ -23,15 +23,7 @@ import java.util.Set; import org.apache.lucene.analysis.MockAnalyzer; -import org.apache.lucene.document.BinaryField; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldSelector; -import org.apache.lucene.document.FieldSelectorVisitor; -import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.SetBasedFieldSelector; -import org.apache.lucene.document.StringField; -import org.apache.lucene.document.TextField; +import org.apache.lucene.document.*; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; @@ -53,7 +45,7 @@ static void addDocumentWithFields(IndexWriter writer) throws IOException { Document doc = new Document(); - FieldType customType3 = new FieldType(); + CoreFieldType customType3 = new CoreFieldType(); customType3.setStored(true); doc.add(newField("keyword", "test1", StringField.TYPE_STORED)); doc.add(newField("text", "test1", TextField.TYPE_STORED)); @@ -66,7 +58,7 @@ static void addDocumentWithDifferentFields(IndexWriter writer) throws IOException { Document doc = new Document(); - FieldType customType3 = new FieldType(); + CoreFieldType customType3 = new CoreFieldType(); customType3.setStored(true); doc.add(newField("keyword2", "test1", StringField.TYPE_STORED)); doc.add(newField("text2", "test1", TextField.TYPE_STORED)); @@ -77,15 +69,15 @@ static void addDocumentWithTermVectorFields(IndexWriter writer) throws IOException { Document doc = new Document(); - FieldType customType5 = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType5 = new CoreFieldType(TextField.TYPE_STORED); customType5.setStoreTermVectors(true); - FieldType customType6 = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType6 = new CoreFieldType(TextField.TYPE_STORED); customType6.setStoreTermVectors(true); customType6.setStoreTermVectorOffsets(true); - FieldType customType7 = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType7 = new CoreFieldType(TextField.TYPE_STORED); customType7.setStoreTermVectors(true); customType7.setStoreTermVectorPositions(true); - FieldType customType8 = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType8 = new CoreFieldType(TextField.TYPE_STORED); customType8.setStoreTermVectors(true); customType8.setStoreTermVectorOffsets(true); customType8.setStoreTermVectorPositions(true); Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java =================================================================== --- lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java (revision 1163903) +++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java (working copy) @@ -1,8 +1,8 @@ package org.apache.lucene.index; import org.apache.lucene.analysis.MockAnalyzer; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Document; -import org.apache.lucene.document.FieldType; import org.apache.lucene.document.TextField; import org.apache.lucene.store.Directory; import org.apache.lucene.util.LuceneTestCase; @@ -28,10 +28,8 @@ Directory dir = newDirectory(); IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))); - Document doc; - - doc = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + Document doc = new Document(); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectorOffsets(true); @@ -41,7 +39,7 @@ iw.addDocument(doc); doc = new Document(); - FieldType customType2 = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType2 = new CoreFieldType(TextField.TYPE_UNSTORED); customType2.setStoreTermVectors(true); customType2.setStoreTermVectorPositions(true); doc.add(newField("a", "a b a c a d a e a f a g a h a", customType2)); @@ -50,7 +48,7 @@ iw.addDocument(doc); doc = new Document(); - FieldType customType3 = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType3 = new CoreFieldType(TextField.TYPE_UNSTORED); customType3.setStoreTermVectors(true); doc.add(newField("a", "a b a c a d a e a f a g a h a", customType3)); doc.add(newField("b", "a b c b d b e b f b g b h b", customType3)); Index: lucene/contrib/misc/src/test/org/apache/lucene/index/TestNRTManager.java =================================================================== --- lucene/contrib/misc/src/test/org/apache/lucene/index/TestNRTManager.java (revision 1163903) +++ lucene/contrib/misc/src/test/org/apache/lucene/index/TestNRTManager.java (working copy) @@ -82,7 +82,7 @@ Field field1 = (Field) f; Field field2 = new Field(field1.name(), - ((Field) f).getFieldType(), + ((Field) f).fieldType(), field1.stringValue()); doc2.add(field2); } Index: lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java =================================================================== --- lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java (revision 1163903) +++ lucene/contrib/misc/src/java/org/apache/lucene/document/FieldSelectorVisitor.java (working copy) @@ -87,7 +87,7 @@ case LOAD_AND_BREAK: final byte[] b = new byte[numUTF8Bytes]; in.readBytes(b, 0, b.length); - FieldType ft = new FieldType(TextField.TYPE_STORED); + CoreFieldType ft = new CoreFieldType(TextField.TYPE_STORED); ft.setStoreTermVectors(fieldInfo.storeTermVector); ft.setStoreTermVectorOffsets(fieldInfo.storeOffsetWithTermVector); ft.setStoreTermVectorPositions(fieldInfo.storePositionWithTermVector); @@ -111,7 +111,7 @@ @Override public boolean intField(FieldInfo fieldInfo, int value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); + CoreFieldType ft = new CoreFieldType(NumericField.TYPE_STORED); ft.setIndexed(fieldInfo.isIndexed); ft.setOmitNorms(fieldInfo.omitNorms); ft.setIndexOptions(fieldInfo.indexOptions); @@ -120,7 +120,7 @@ @Override public boolean longField(FieldInfo fieldInfo, long value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); + CoreFieldType ft = new CoreFieldType(NumericField.TYPE_STORED); ft.setIndexed(fieldInfo.isIndexed); ft.setOmitNorms(fieldInfo.omitNorms); ft.setIndexOptions(fieldInfo.indexOptions); @@ -129,7 +129,7 @@ @Override public boolean floatField(FieldInfo fieldInfo, float value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); + CoreFieldType ft = new CoreFieldType(NumericField.TYPE_STORED); ft.setIndexed(fieldInfo.isIndexed); ft.setOmitNorms(fieldInfo.omitNorms); ft.setIndexOptions(fieldInfo.indexOptions); @@ -138,7 +138,7 @@ @Override public boolean doubleField(FieldInfo fieldInfo, double value) throws IOException { - FieldType ft = new FieldType(NumericField.TYPE_STORED); + CoreFieldType ft = new CoreFieldType(NumericField.TYPE_STORED); ft.setIndexed(fieldInfo.isIndexed); ft.setOmitNorms(fieldInfo.omitNorms); ft.setIndexOptions(fieldInfo.indexOptions); @@ -170,7 +170,7 @@ final long pointer = in.getFilePointer(); // Need to move the pointer ahead by toRead positions in.seek(pointer+numBytes); - FieldType ft = new FieldType(); + CoreFieldType ft = new CoreFieldType(); ft.setStored(true); ft.setOmitNorms(fi.omitNorms); ft.setIndexOptions(fi.indexOptions); @@ -210,7 +210,7 @@ private final IndexInput in; private boolean isBinary; - public LazyField(IndexInput in, String name, FieldType ft, int toRead, long pointer, boolean isBinary, boolean cacheResult) { + public LazyField(IndexInput in, String name, CoreFieldType ft, int toRead, long pointer, boolean isBinary, boolean cacheResult) { super(name, ft); this.in = in; this.toRead = toRead; 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 1163903) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (working copy) @@ -26,9 +26,9 @@ import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; +import org.apache.lucene.document.CoreFieldType; 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.CorruptIndexException; import org.apache.lucene.index.IndexReader; @@ -60,7 +60,7 @@ newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); @@ -108,7 +108,7 @@ try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); @@ -183,7 +183,7 @@ try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); @@ -230,7 +230,7 @@ try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_STORED); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectors(true); document.add(new Field(FIELD, customType, TEXT)); @@ -273,7 +273,7 @@ newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random, MockTokenizer.WHITESPACE, false))); try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); customType.setStoreTermVectors(true); 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 1163903) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (working copy) @@ -26,9 +26,9 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; +import org.apache.lucene.document.CoreFieldType; 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.CorruptIndexException; import org.apache.lucene.index.IndexReader; @@ -108,7 +108,7 @@ newIndexWriterConfig(TEST_VERSION_CURRENT, new OverlapAnalyzer())); try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); document.add(new Field(FIELD, customType, new TokenStreamOverlap())); @@ -156,7 +156,7 @@ newIndexWriterConfig(TEST_VERSION_CURRENT, new OverlapAnalyzer())); try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); @@ -205,7 +205,7 @@ newIndexWriterConfig(TEST_VERSION_CURRENT, new OverlapAnalyzer())); try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); document.add(new Field(FIELD, customType, new TokenStreamOverlap())); @@ -254,7 +254,7 @@ newIndexWriterConfig(TEST_VERSION_CURRENT, new OverlapAnalyzer())); try { final Document document = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); document.add(new Field(FIELD, customType, new TokenStreamOverlap())); 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 1163903) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java (working copy) @@ -32,9 +32,9 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; +import org.apache.lucene.document.CoreFieldType; 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.IndexWriter; @@ -358,7 +358,7 @@ IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzer).setOpenMode(OpenMode.CREATE)); Document doc = new Document(); - FieldType customType = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_STORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); @@ -376,7 +376,7 @@ IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzerK).setOpenMode(OpenMode.CREATE)); Document doc = new Document(); - FieldType customType = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_STORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); 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 1163903) +++ lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java (working copy) @@ -17,9 +17,9 @@ * limitations under the License. */ +import org.apache.lucene.document.CoreFieldType; 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.IndexWriter; @@ -138,7 +138,7 @@ IndexWriter writer = new IndexWriter(dir, new IndexWriterConfig( TEST_VERSION_CURRENT, analyzerW).setOpenMode(OpenMode.CREATE)); Document doc = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorOffsets(true); customType.setStoreTermVectorPositions(true); 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 1163903) +++ lucene/contrib/highlighter/src/java/org/apache/lucene/search/vectorhighlight/BaseFragmentsBuilder.java (working copy) @@ -21,8 +21,8 @@ import java.util.ArrayList; import java.util.List; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldType; import org.apache.lucene.document.TextField; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.IndexReader; @@ -119,7 +119,7 @@ if (fieldInfo.name.equals(fieldName)) { final byte[] b = new byte[numUTF8Bytes]; in.readBytes(b, 0, b.length); - FieldType ft = new FieldType(TextField.TYPE_STORED); + CoreFieldType ft = new CoreFieldType(TextField.TYPE_STORED); ft.setStoreTermVectors(fieldInfo.storeTermVector); ft.setStoreTermVectorOffsets(fieldInfo.storeOffsetWithTermVector); ft.setStoreTermVectorPositions(fieldInfo.storePositionWithTermVector); Index: lucene/contrib/sandbox/src/test/org/apache/lucene/sandbox/queries/regex/TestSpanRegexQuery.java =================================================================== --- lucene/contrib/sandbox/src/test/org/apache/lucene/sandbox/queries/regex/TestSpanRegexQuery.java (revision 1163903) +++ lucene/contrib/sandbox/src/test/org/apache/lucene/sandbox/queries/regex/TestSpanRegexQuery.java (working copy) @@ -20,8 +20,8 @@ import java.io.IOException; import org.apache.lucene.analysis.MockAnalyzer; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Document; -import org.apache.lucene.document.FieldType; import org.apache.lucene.document.TextField; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexWriter; @@ -86,7 +86,7 @@ LockObtainFailedException, IOException { // creating a document to store Document lDoc = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setOmitNorms(true); lDoc.add(newField("field", "a1 b1", customType)); Index: lucene/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java (revision 1163903) +++ lucene/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java (working copy) @@ -17,12 +17,12 @@ * limitations under the License. */ +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.analysis.MockTokenizer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldType; import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; @@ -137,7 +137,7 @@ private static Document makeDocument(String docText) { Document doc = new Document(); - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setOmitNorms(true); Field f = new Field("f", customType, docText); doc.add(f); Index: lucene/src/test/org/apache/lucene/search/cache/TestEntryCreators.java =================================================================== --- lucene/src/test/org/apache/lucene/search/cache/TestEntryCreators.java (revision 1163903) +++ lucene/src/test/org/apache/lucene/search/cache/TestEntryCreators.java (working copy) @@ -23,8 +23,8 @@ import java.util.Set; import org.apache.lucene.analysis.MockAnalyzer; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Document; -import org.apache.lucene.document.FieldType; import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; @@ -92,7 +92,7 @@ for( NumberTypeTester tester : typeTests ) { if (random.nextInt(20) != 17 && i > 1) { tester.values[i] = 10 + random.nextInt( 20 ); // get some field overlap - FieldType customType = new FieldType(TextField.TYPE_UNSTORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_UNSTORED); customType.setTokenized(false); doc.add(newField(tester.field, String.valueOf(tester.values[i]), customType)); } Index: lucene/src/test/org/apache/lucene/search/TestSort.java =================================================================== --- lucene/src/test/org/apache/lucene/search/TestSort.java (revision 1163903) +++ lucene/src/test/org/apache/lucene/search/TestSort.java (working copy) @@ -25,12 +25,7 @@ import java.util.concurrent.TimeUnit; import org.apache.lucene.analysis.MockAnalyzer; -import org.apache.lucene.document.IndexDocValuesField; -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.document.*; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader.AtomicReaderContext; @@ -125,9 +120,9 @@ dirs.add(indexStore); RandomIndexWriter writer = new RandomIndexWriter(random, indexStore, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy())); - FieldType ft1 = new FieldType(); + CoreFieldType ft1 = new CoreFieldType(); ft1.setStored(true); - FieldType ft2 = new FieldType(); + CoreFieldType ft2 = new CoreFieldType(); ft2.setIndexed(true); for (int i=0; i fieldIDs = new ArrayList(); - FieldType customType = new FieldType(TextField.TYPE_STORED); + CoreFieldType customType = new CoreFieldType(TextField.TYPE_STORED); customType.setTokenized(false); Field idField = newField("id", "", customType); @@ -1595,7 +1591,7 @@ System.out.println("TEST: build index docCount=" + docCount); } - FieldType customType2 = new FieldType(); + CoreFieldType customType2 = new CoreFieldType(); customType2.setStored(true); for(int i=0;i 0) fieldState.position += docState.analyzer == null ? 0 : docState.analyzer.getPositionIncrementGap(fieldInfo.name); @@ -83,7 +83,7 @@ // outside of indexer -- field should simply give us // a TokenStream, even for multi-valued fields - if (!field.tokenized()) { // un-tokenized field + if (!field.fieldType().tokenized()) { // un-tokenized field final String stringValue = field.stringValue(); assert stringValue != null; final int valueLength = stringValue.length(); Index: lucene/src/java/org/apache/lucene/index/FieldInfos.java =================================================================== --- lucene/src/java/org/apache/lucene/index/FieldInfos.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/FieldInfos.java (working copy) @@ -456,6 +456,12 @@ storeOffsetWithTermVector, omitNorms, storePayloads, indexOptions, docValues); } + synchronized public FieldInfo addOrUpdate(String name, FieldType fieldType, boolean scorePayloads, ValueType docValues) { + return addOrUpdateInternal(name, -1, fieldType.indexed(), fieldType.storeTermVectors(), + fieldType.storeTermVectorPositions(), fieldType.storeTermVectorOffsets(), fieldType.omitNorms(), scorePayloads, + fieldType.indexOptions(), docValues); + } + synchronized private FieldInfo addOrUpdateInternal(String name, int preferredFieldNumber, boolean isIndexed, boolean storeTermVector, boolean storePositionWithTermVector, boolean storeOffsetWithTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, ValueType docValues) { Index: lucene/src/java/org/apache/lucene/index/FieldsWriter.java =================================================================== --- lucene/src/java/org/apache/lucene/index/FieldsWriter.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/FieldsWriter.java (working copy) @@ -217,14 +217,14 @@ int storedCount = 0; for (IndexableField field : doc) { - if (field.stored()) { + if (field.fieldType().stored()) { storedCount++; } } fieldsStream.writeVInt(storedCount); for (IndexableField field : doc) { - if (field.stored()) { + if (field.fieldType().stored()) { writeField(fieldInfos.fieldNumber(field.name()), field); } } Index: lucene/src/java/org/apache/lucene/index/IndexableField.java =================================================================== --- lucene/src/java/org/apache/lucene/index/IndexableField.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/IndexableField.java (working copy) @@ -48,9 +48,6 @@ /** Field boost (you must pre-multiply in any doc boost). */ public float boost(); - /* True if the field's value should be stored */ - public boolean stored(); - /* Non-null if this field has a binary value */ public BytesRef binaryValue(); @@ -74,27 +71,7 @@ /* Numeric value; only used if the field is numeric */ public Number numericValue(); - /* True if this field should be indexed (inverted) */ - public boolean indexed(); - - /* True if this field's value should be analyzed */ - public boolean tokenized(); - - /* True if norms should not be indexed */ - public boolean omitNorms(); - - /* {@link IndexOptions}, describing what should be - * recorded into the inverted index */ - public IndexOptions indexOptions(); - - /* True if term vectors should be indexed */ - public boolean storeTermVectors(); - - /* True if term vector offsets should be indexed */ - public boolean storeTermVectorOffsets(); - - /* True if term vector positions should be indexed */ - public boolean storeTermVectorPositions(); + public FieldType fieldType(); /* Non-null if doc values should be indexed */ public PerDocFieldValues docValues(); Index: lucene/src/java/org/apache/lucene/index/CheckIndex.java =================================================================== --- lucene/src/java/org/apache/lucene/index/CheckIndex.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/CheckIndex.java (working copy) @@ -17,7 +17,7 @@ * limitations under the License. */ -import org.apache.lucene.document.FieldType; // for javadocs +import org.apache.lucene.index.FieldType; // for javadocs import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.TermQuery; Index: lucene/src/java/org/apache/lucene/index/PersistentSnapshotDeletionPolicy.java =================================================================== --- lucene/src/java/org/apache/lucene/index/PersistentSnapshotDeletionPolicy.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/PersistentSnapshotDeletionPolicy.java (working copy) @@ -23,9 +23,9 @@ import java.util.Map; import java.util.Map.Entry; +import org.apache.lucene.document.CoreFieldType; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldType; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.store.Directory; import org.apache.lucene.store.LockObtainFailedException; @@ -186,7 +186,7 @@ private void persistSnapshotInfos(String id, String segment) throws IOException { writer.deleteAll(); Document d = new Document(); - FieldType ft = new FieldType(); + CoreFieldType ft = new CoreFieldType(); ft.setStored(true); d.add(new Field(SNAPSHOTS_ID, ft, "")); for (Entry e : super.getSnapshots().entrySet()) { Index: lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java =================================================================== --- lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java (working copy) @@ -223,9 +223,7 @@ // needs to be more "pluggable" such that if I want // to have a new "thing" my Fields can do, I can // easily add it - FieldInfo fi = fieldInfos.addOrUpdate(fieldName, field.indexed(), field.storeTermVectors(), - field.storeTermVectorPositions(), field.storeTermVectorOffsets(), - field.omitNorms(), false, field.indexOptions(), field.docValuesType()); + FieldInfo fi = fieldInfos.addOrUpdate(fieldName, field.fieldType(), false, field.docValuesType()); fp = new DocFieldProcessorPerField(this, fi); fp.next = fieldHash[hashPos]; @@ -236,9 +234,7 @@ rehash(); } } else { - fieldInfos.addOrUpdate(fp.fieldInfo.name, field.indexed(), field.storeTermVectors(), - field.storeTermVectorPositions(), field.storeTermVectorOffsets(), - field.omitNorms(), false, field.indexOptions(), field.docValuesType()); + fieldInfos.addOrUpdate(fp.fieldInfo.name, field.fieldType(), false, field.docValuesType()); } if (thisFieldGen != fp.lastGen) { @@ -259,7 +255,7 @@ fp.addField(field); - if (field.stored()) { + if (field.fieldType().stored()) { fieldsWriter.addField(field, fp.fieldInfo); } final PerDocFieldValues docValues = field.docValues(); Index: lucene/src/java/org/apache/lucene/index/FieldType.java =================================================================== --- lucene/src/java/org/apache/lucene/index/FieldType.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/FieldType.java (working copy) @@ -1,4 +1,4 @@ -package org.apache.lucene.document; +package org.apache.lucene.index; /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -19,157 +19,21 @@ import org.apache.lucene.index.FieldInfo.IndexOptions; -public class FieldType { - - private boolean indexed; - private boolean stored; - private boolean tokenized; - private boolean storeTermVectors; - private boolean storeTermVectorOffsets; - private boolean storeTermVectorPositions; - private boolean omitNorms; - private IndexOptions indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; - private boolean frozen; - - public FieldType(FieldType ref) { - this.indexed = ref.indexed(); - this.stored = ref.stored(); - this.tokenized = ref.tokenized(); - this.storeTermVectors = ref.storeTermVectors(); - this.storeTermVectorOffsets = ref.storeTermVectorOffsets(); - this.storeTermVectorPositions = ref.storeTermVectorPositions(); - this.omitNorms = ref.omitNorms(); - this.indexOptions = ref.indexOptions(); - // Do not copy frozen! - } +public interface FieldType { - public FieldType() { - } + public boolean indexed(); - private void checkIfFrozen() { - if (frozen) { - throw new IllegalStateException(); - } - } + public boolean stored(); - /** Prevents future changes. Note that when a FieldType - * is first bound to a Field instance, it is frozen. */ - public void freeze() { - this.frozen = true; - } - - public boolean indexed() { - return this.indexed; - } - - public void setIndexed(boolean value) { - checkIfFrozen(); - this.indexed = value; - } + public boolean tokenized(); - public boolean stored() { - return this.stored; - } - - public void setStored(boolean value) { - checkIfFrozen(); - this.stored = value; - } + public boolean storeTermVectors(); - public boolean tokenized() { - return this.tokenized; - } - - public void setTokenized(boolean value) { - checkIfFrozen(); - this.tokenized = value; - } + public boolean storeTermVectorOffsets(); - public boolean storeTermVectors() { - return this.storeTermVectors; - } + public boolean storeTermVectorPositions(); - public void setStoreTermVectors(boolean value) { - checkIfFrozen(); - this.storeTermVectors = value; - } + public boolean omitNorms(); - public boolean storeTermVectorOffsets() { - return this.storeTermVectorOffsets; - } - - public void setStoreTermVectorOffsets(boolean value) { - checkIfFrozen(); - this.storeTermVectorOffsets = value; - } - - public boolean storeTermVectorPositions() { - return this.storeTermVectorPositions; - } - - public void setStoreTermVectorPositions(boolean value) { - checkIfFrozen(); - this.storeTermVectorPositions = value; - } - - public boolean omitNorms() { - return this.omitNorms; - } - - public void setOmitNorms(boolean value) { - checkIfFrozen(); - this.omitNorms = value; - } - - public IndexOptions indexOptions() { - return this.indexOptions; - } - - public void setIndexOptions(IndexOptions value) { - checkIfFrozen(); - this.indexOptions = value; - } - - /** Prints a Field for human consumption. */ - @Override - public final String toString() { - StringBuilder result = new StringBuilder(); - if (stored()) { - result.append("stored"); - } - if (indexed()) { - if (result.length() > 0) - result.append(","); - result.append("indexed"); - } - if (tokenized()) { - if (result.length() > 0) - result.append(","); - result.append("tokenized"); - } - if (storeTermVectors()) { - if (result.length() > 0) - result.append(","); - result.append("termVector"); - } - if (storeTermVectorOffsets()) { - if (result.length() > 0) - result.append(","); - result.append("termVectorOffsets"); - } - if (storeTermVectorPositions()) { - if (result.length() > 0) - result.append(","); - result.append("termVectorPosition"); - } - if (omitNorms()) { - result.append(",omitNorms"); - } - if (indexOptions != IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) { - result.append(",indexOptions="); - result.append(indexOptions); - } - - return result.toString(); - } + public IndexOptions indexOptions(); } Index: lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java =================================================================== --- lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java (working copy) @@ -83,7 +83,7 @@ @Override boolean start(IndexableField[] fields, int count) { for(int i=0;i * *

- * If doc values are stored in addition to an indexed ({@link FieldType#setIndexed(boolean)}) or stored - * ({@link FieldType#setStored(boolean)}) value it's recommended to pass the appropriate {@link FieldType} + * If doc values are stored in addition to an indexed ({@link CoreFieldType#setIndexed(boolean)}) or stored + * ({@link CoreFieldType#setStored(boolean)}) value it's recommended to pass the appropriate {@link CoreFieldType} * when creating the field: * *

@@ -81,7 +82,7 @@
    * Creates a new {@link IndexDocValuesField} with the given name.
    */
   public IndexDocValuesField(String name) {
-    this(name, new FieldType());
+    this(name, new CoreFieldType());
   }
 
   public IndexDocValuesField(String name, FieldType type) {
@@ -349,14 +350,14 @@
    * Returns an IndexDocValuesField holding the value from
    * the provided string field, as the specified type.  The
    * incoming field must have a string value.  The name, {@link
-   * FieldType} and string value are carried over from the
+   * CoreFieldType} and string value are carried over from the
    * incoming Field.
    */
   public static IndexDocValuesField build(Field field, ValueType type) {
     if (field instanceof IndexDocValuesField) {
       return (IndexDocValuesField) field;
     }
-    final IndexDocValuesField valField = new IndexDocValuesField(field.name(), field.getFieldType(), field.stringValue());
+    final IndexDocValuesField valField = new IndexDocValuesField(field.name(), field.fieldType(), field.stringValue());
     switch (type) {
     case BYTES_FIXED_DEREF:
     case BYTES_FIXED_SORTED:
Index: lucene/src/java/org/apache/lucene/document/Field.java
===================================================================
--- lucene/src/java/org/apache/lucene/document/Field.java	(revision 1163903)
+++ lucene/src/java/org/apache/lucene/document/Field.java	(working copy)
@@ -20,7 +20,7 @@
 import java.io.Reader;
 
 import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.index.FieldInfo.IndexOptions;
+import org.apache.lucene.index.FieldType;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.index.values.PerDocFieldValues;
 import org.apache.lucene.index.values.ValueType;
@@ -50,7 +50,6 @@
   public Field(String name, FieldType type) {
     this.name = name;
     this.type = type;
-    type.freeze();
   }
   
   public Field(String name, FieldType type, Reader reader) {
@@ -64,7 +63,6 @@
     this.name = name;
     this.fieldsData = reader;
     this.type = type;
-    type.freeze();
   }
   
   public Field(String name, FieldType type, TokenStream tokenStream) {
@@ -79,7 +77,6 @@
     this.fieldsData = null;
     this.tokenStream = tokenStream;
     this.type = type;
-    type.freeze();
   }
   
   public Field(String name, FieldType type, byte[] value) {
@@ -90,14 +87,12 @@
     this.fieldsData = new BytesRef(value, offset, length);
     this.type = type;
     this.name = name;
-    type.freeze();
   }
 
   public Field(String name, FieldType type, BytesRef bytes) {
     this.fieldsData = bytes;
     this.type = type;
     this.name = name;
-    type.freeze();
   }
   
   public Field(String name, FieldType type, String value) {
@@ -119,7 +114,6 @@
     this.type = type;
     this.name = name;
     this.fieldsData = value;
-    type.freeze();
   }
 
   /**
@@ -181,7 +175,7 @@
       throw new IllegalArgumentException(
           "cannot set a Reader value on a binary field");
     }
-    if (stored()) {
+    if (type.stored()) {
       throw new IllegalArgumentException(
           "cannot set a Reader value on a stored field");
     }
@@ -206,7 +200,7 @@
    * values from stringValue() or getBinaryValue()
    */
   public void setTokenStream(TokenStream tokenStream) {
-    if (!indexed() || !tokenized()) {
+    if (!type.indexed() || !type.tokenized()) {
       throw new IllegalArgumentException(
           "cannot set token stream on non indexed and tokenized field");
     }
@@ -265,38 +259,6 @@
     return fieldsData instanceof BytesRef;
   }
   
-  public boolean stored() {
-    return type.stored();
-  }
-  
-  public boolean indexed() {
-    return type.indexed();
-  }
-  
-  public boolean tokenized() {
-    return type.tokenized();
-  }
-  
-  public boolean omitNorms() {
-    return type.omitNorms();
-  }
-  
-  public IndexOptions indexOptions() {
-    return type.indexOptions();
-  }
-  
-  public boolean storeTermVectors() {
-    return type.storeTermVectors();
-  }
-  
-  public boolean storeTermVectorOffsets() {
-    return type.storeTermVectorOffsets();
-  }
-  
-  public boolean storeTermVectorPositions() {
-    return type.storeTermVectorPositions();
-  }
-  
   /** Prints a Field for human consumption. */
   @Override
   public String toString() {
@@ -329,7 +291,7 @@
   }
 
   /** Returns FieldType for this field. */
-  public FieldType getFieldType() {
+  public FieldType fieldType() {
     return type;
   }
 }
Index: lucene/src/java/org/apache/lucene/document/FieldType.java (deleted)
===================================================================
Index: lucene/src/java/org/apache/lucene/document/NumericField.java
===================================================================
--- lucene/src/java/org/apache/lucene/document/NumericField.java	(revision 1163903)
+++ lucene/src/java/org/apache/lucene/document/NumericField.java	(working copy)
@@ -22,7 +22,6 @@
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.NumericTokenStream;
 import org.apache.lucene.index.FieldInfo.IndexOptions;
-import org.apache.lucene.document.NumericField.DataType;
 import org.apache.lucene.util.NumericUtils;
 import org.apache.lucene.search.NumericRangeQuery; // javadocs
 import org.apache.lucene.search.NumericRangeFilter; // javadocs
@@ -76,7 +75,7 @@
  *
  * 

By default, a NumericField's value is not stored but * is indexed for range filtering and sorting. You can use - * the {@link #NumericField(String, FieldType)} + * the {@link #NumericField(String, CoreFieldType)} * constructor if you need to change these defaults.

* *

You may add the same field name as a NumericField to @@ -104,7 +103,7 @@ * default value, 4, was selected for a reasonable tradeoff * of disk space consumption versus performance. You can * use the expert constructor {@link - * #NumericField(String,int,FieldType)} if you'd + * #NumericField(String,int,CoreFieldType)} if you'd * like to change the value. Note that you must also * specify a congruent value when creating {@link * NumericRangeQuery} or {@link NumericRangeFilter}. @@ -138,8 +137,8 @@ */ public static enum DataType { INT, LONG, FLOAT, DOUBLE } - public static final FieldType TYPE_UNSTORED = new FieldType(); - public static final FieldType TYPE_STORED = new FieldType(); + public static final CoreFieldType TYPE_UNSTORED = new CoreFieldType(); + public static final CoreFieldType TYPE_STORED = new CoreFieldType(); static { TYPE_UNSTORED.setIndexed(true); TYPE_UNSTORED.setTokenized(true); @@ -191,7 +190,7 @@ * instances on search results, or indexed using * {@link NumericTokenStream} */ - public NumericField(String name, FieldType type) { + public NumericField(String name, CoreFieldType type) { this(name, NumericUtils.PRECISION_STEP_DEFAULT, type); } @@ -231,14 +230,14 @@ * instances on search results, or indexed using * {@link NumericTokenStream} */ - public NumericField(String name, int precisionStep, FieldType type) { + public NumericField(String name, int precisionStep, CoreFieldType type) { super(name, type); this.precisionStep = precisionStep; } /** Returns a {@link NumericTokenStream} for indexing the numeric value. */ public TokenStream tokenStreamValue() { - if (!indexed()) return null; + if (!type.indexed()) return null; if (numericTS == null) { // lazy init the TokenStream as it is heavy to instantiate // (attributes,...), Index: lucene/src/java/org/apache/lucene/document/BinaryField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/BinaryField.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/document/BinaryField.java (working copy) @@ -23,7 +23,7 @@ public final class BinaryField extends Field { - public static final FieldType TYPE_STORED = new FieldType(); + public static final CoreFieldType TYPE_STORED = new CoreFieldType(); static { TYPE_STORED.setStored(true); TYPE_STORED.freeze(); Index: lucene/src/java/org/apache/lucene/document/TextField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/TextField.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/document/TextField.java (working copy) @@ -32,10 +32,10 @@ public final class TextField extends Field { /* Indexed, tokenized, not stored. */ - public static final FieldType TYPE_UNSTORED = new FieldType(); + public static final CoreFieldType TYPE_UNSTORED = new CoreFieldType(); /* Indexed, tokenized, stored. */ - public static final FieldType TYPE_STORED = new FieldType(); + public static final CoreFieldType TYPE_STORED = new CoreFieldType(); static { TYPE_UNSTORED.setIndexed(true); Index: lucene/src/java/org/apache/lucene/document/StringField.java =================================================================== --- lucene/src/java/org/apache/lucene/document/StringField.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/document/StringField.java (working copy) @@ -33,11 +33,11 @@ /** Indexed, not tokenized, omits norms, indexes * DOCS_ONLY, not stored. */ - public static final FieldType TYPE_UNSTORED = new FieldType(); + public static final CoreFieldType TYPE_UNSTORED = new CoreFieldType(); /** Indexed, not tokenized, omits norms, indexes * DOCS_ONLY, stored */ - public static final FieldType TYPE_STORED = new FieldType(); + public static final CoreFieldType TYPE_STORED = new CoreFieldType(); static { TYPE_UNSTORED.setIndexed(true); Index: lucene/src/java/org/apache/lucene/document/Document.java =================================================================== --- lucene/src/java/org/apache/lucene/document/Document.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/document/Document.java (working copy) @@ -19,6 +19,7 @@ import java.util.*; +import org.apache.lucene.index.FieldType; import org.apache.lucene.index.IndexReader; // for javadoc import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.IndexSearcher; // for javadoc @@ -28,12 +29,12 @@ /** Documents are the unit of indexing and search. * * A Document is a set of fields. Each field has a name and a textual value. - * A field may be {@link IndexableField#stored() stored} with the document, in which + * A field may be {@link FieldType#stored() stored} with the document, in which * case it is returned with search hits on the document. Thus each document * should typically contain one or more stored fields which uniquely identify * it. * - *

Note that fields which are not {@link IndexableField#stored() stored} are + *

Note that fields which are not {@link FieldType#stored() stored} are * not available in documents retrieved from the index, e.g. with {@link * ScoreDoc#doc} or {@link IndexReader#document(int)}. */ Index: lucene/src/java/org/apache/lucene/document/CoreFieldType.java =================================================================== --- lucene/src/java/org/apache/lucene/document/CoreFieldType.java (revision 1163903) +++ lucene/src/java/org/apache/lucene/document/CoreFieldType.java (working copy) @@ -18,8 +18,9 @@ */ import org.apache.lucene.index.FieldInfo.IndexOptions; +import org.apache.lucene.index.FieldType; -public class FieldType { +public class CoreFieldType implements FieldType { private boolean indexed; private boolean stored; @@ -31,7 +32,7 @@ private IndexOptions indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; private boolean frozen; - public FieldType(FieldType ref) { + public CoreFieldType(FieldType ref) { this.indexed = ref.indexed(); this.stored = ref.stored(); this.tokenized = ref.tokenized(); @@ -43,7 +44,7 @@ // Do not copy frozen! } - public FieldType() { + public CoreFieldType() { } private void checkIfFrozen() { Index: lucene/src/test-framework/org/apache/lucene/analysis/CollationTestBase.java =================================================================== --- lucene/src/test-framework/org/apache/lucene/analysis/CollationTestBase.java (revision 1163903) +++ lucene/src/test-framework/org/apache/lucene/analysis/CollationTestBase.java (working copy) @@ -19,6 +19,7 @@ import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; +import org.apache.lucene.document.*; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; @@ -33,11 +34,6 @@ import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; -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.util.BytesRef; import org.apache.lucene.util.IndexableBinaryStringTools; import org.apache.lucene.util.LuceneTestCase; @@ -199,7 +195,7 @@ { "J", "y", "HOT", "HOT", "HOT", "HOT" }, }; - FieldType customType = new FieldType(); + CoreFieldType customType = new CoreFieldType(); customType.setStored(true); for (int i = 0 ; i < sortData.length ; ++i) { Index: lucene/src/test-framework/org/apache/lucene/index/DocHelper.java =================================================================== --- lucene/src/test-framework/org/apache/lucene/index/DocHelper.java (revision 1163903) +++ lucene/src/test-framework/org/apache/lucene/index/DocHelper.java (working copy) @@ -26,13 +26,8 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.analysis.MockTokenizer; -import org.apache.lucene.document.BinaryField; -import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; -import org.apache.lucene.document.StringField; +import org.apache.lucene.document.*; import org.apache.lucene.index.FieldInfo.IndexOptions; -import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.TextField; import org.apache.lucene.search.SimilarityProvider; import org.apache.lucene.store.Directory; @@ -40,36 +35,36 @@ class DocHelper { - public static final FieldType customType; + public static final CoreFieldType customType; public static final String FIELD_1_TEXT = "field one text"; public static final String TEXT_FIELD_1_KEY = "textField1"; public static Field textField1; static { - customType = new FieldType(TextField.TYPE_STORED); + customType = new CoreFieldType(TextField.TYPE_STORED); textField1 = new Field(TEXT_FIELD_1_KEY, customType, FIELD_1_TEXT); } - public static final FieldType customType2; + public static final CoreFieldType customType2; public static final String FIELD_2_TEXT = "field field field two text"; //Fields will be lexicographically sorted. So, the order is: field, text, two public static final int [] FIELD_2_FREQS = {3, 1, 1}; public static final String TEXT_FIELD_2_KEY = "textField2"; public static Field textField2; static { - customType2 = new FieldType(TextField.TYPE_STORED); + customType2 = new CoreFieldType(TextField.TYPE_STORED); customType2.setStoreTermVectors(true); customType2.setStoreTermVectorPositions(true); customType2.setStoreTermVectorOffsets(true); textField2 = new Field(TEXT_FIELD_2_KEY, customType2, FIELD_2_TEXT); } - public static final FieldType customType3; + public static final CoreFieldType customType3; public static final String FIELD_3_TEXT = "aaaNoNorms aaaNoNorms bbbNoNorms"; public static final String TEXT_FIELD_3_KEY = "textField3"; public static Field textField3; static { - customType3 = new FieldType(TextField.TYPE_STORED); + customType3 = new CoreFieldType(TextField.TYPE_STORED); customType3.setOmitNorms(true); textField3 = new Field(TEXT_FIELD_3_KEY, customType3, FIELD_3_TEXT); } @@ -81,33 +76,33 @@ keyField = new Field(KEYWORD_FIELD_KEY, StringField.TYPE_STORED, KEYWORD_TEXT); } - public static final FieldType customType5; + public static final CoreFieldType customType5; public static final String NO_NORMS_TEXT = "omitNormsText"; public static final String NO_NORMS_KEY = "omitNorms"; public static Field noNormsField; static { - customType5 = new FieldType(TextField.TYPE_STORED); + customType5 = new CoreFieldType(TextField.TYPE_STORED); customType5.setOmitNorms(true); customType5.setTokenized(false); noNormsField = new Field(NO_NORMS_KEY, customType5, NO_NORMS_TEXT); } - public static final FieldType customType6; + public static final CoreFieldType customType6; public static final String NO_TF_TEXT = "analyzed with no tf and positions"; public static final String NO_TF_KEY = "omitTermFreqAndPositions"; public static Field noTFField; static { - customType6 = new FieldType(TextField.TYPE_STORED); + customType6 = new CoreFieldType(TextField.TYPE_STORED); customType6.setIndexOptions(IndexOptions.DOCS_ONLY); noTFField = new Field(NO_TF_KEY, customType6, NO_TF_TEXT); } - public static final FieldType customType7; + public static final CoreFieldType customType7; public static final String UNINDEXED_FIELD_TEXT = "unindexed field text"; public static final String UNINDEXED_FIELD_KEY = "unIndField"; public static Field unIndField; static { - customType7 = new FieldType(); + customType7 = new CoreFieldType(); customType7.setStored(true); unIndField = new Field(UNINDEXED_FIELD_KEY, customType7, UNINDEXED_FIELD_TEXT); } @@ -117,12 +112,12 @@ 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 final FieldType customType8; + public static final CoreFieldType customType8; public static final String UNSTORED_2_FIELD_TEXT = "unstored field text"; public static final String UNSTORED_FIELD_2_KEY = "unStoredField2"; public static Field unStoredField2; static { - customType8 = new FieldType(TextField.TYPE_UNSTORED); + customType8 = new CoreFieldType(TextField.TYPE_UNSTORED); customType8.setStoreTermVectors(true); unStoredField2 = new Field(UNSTORED_FIELD_2_KEY, customType8, UNSTORED_2_FIELD_TEXT); } @@ -205,15 +200,15 @@ for (int i=0; i