Index: lucene/analysis/uima/src/test/org/apache/lucene/analysis/uima/UIMABaseAnalyzerTest.java =================================================================== --- lucene/analysis/uima/src/test/org/apache/lucene/analysis/uima/UIMABaseAnalyzerTest.java (revision 1371227) +++ lucene/analysis/uima/src/test/org/apache/lucene/analysis/uima/UIMABaseAnalyzerTest.java (working copy) @@ -21,11 +21,11 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.TopDocs; Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java (working copy) @@ -226,7 +226,7 @@ final DocState ds = getDocState(); final Document doc = reuseFields ? ds.doc : new Document(); - doc.getFields().clear(); + doc.clear(); // Set ID_FIELD FieldType ft = new FieldType(valType); Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/BenchmarkHighlighter.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/BenchmarkHighlighter.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/BenchmarkHighlighter.java (working copy) @@ -19,8 +19,8 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; /** * Abstract class for benchmarking highlighting performance Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTask.java (working copy) @@ -28,12 +28,12 @@ import org.apache.lucene.benchmark.byTask.PerfRunData; import org.apache.lucene.benchmark.byTask.feeds.QueryMaker; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.Collector; import org.apache.lucene.search.TopDocs; import org.apache.lucene.search.MultiTermQuery; Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/ReadTokensTask.java (working copy) @@ -26,6 +26,7 @@ import org.apache.lucene.benchmark.byTask.PerfRunData; import org.apache.lucene.benchmark.byTask.feeds.DocMaker; import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; import org.apache.lucene.document.IntField; import org.apache.lucene.document.LongField; import org.apache.lucene.document.FloatField; @@ -68,7 +69,7 @@ @Override public int doLogic() throws Exception { - List fields = doc.getFields(); + List fields = doc.getFields(); Analyzer analyzer = getRunData().getAnalyzer(); int tokenCount = 0; for(final IndexableField field : fields) { Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetHighlightTask.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetHighlightTask.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetHighlightTask.java (working copy) @@ -21,8 +21,8 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.benchmark.byTask.PerfRunData; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.Query; import org.apache.lucene.search.highlight.Highlighter; import org.apache.lucene.search.highlight.QueryScorer; Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetLoadFieldSelectorTask.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetLoadFieldSelectorTask.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetLoadFieldSelectorTask.java (working copy) @@ -24,8 +24,8 @@ import org.apache.lucene.benchmark.byTask.PerfRunData; import org.apache.lucene.document.Document; import org.apache.lucene.document.DocumentStoredFieldVisitor; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; /** * Search and Traverse and Retrieve docs task using a Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetVectorHighlightTask.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetVectorHighlightTask.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/SearchTravRetVectorHighlightTask.java (working copy) @@ -20,8 +20,8 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.benchmark.byTask.PerfRunData; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.Query; import org.apache.lucene.search.vectorhighlight.FastVectorHighlighter; import org.apache.lucene.search.vectorhighlight.FieldQuery; Index: lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTask.java =================================================================== --- lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTask.java (revision 1371227) +++ lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTask.java (working copy) @@ -33,6 +33,7 @@ import org.apache.lucene.benchmark.byTask.utils.StreamUtils; import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; /** * A task which writes documents, one line per document. Each line is in the @@ -172,7 +173,7 @@ boolean sufficient = !checkSufficientFields; for (int i=0; i0 && sufficientFields[i]; Index: lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingHighlighterTestTask.java =================================================================== --- lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingHighlighterTestTask.java (revision 1371227) +++ lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/CountingHighlighterTestTask.java (working copy) @@ -27,8 +27,8 @@ import org.apache.lucene.search.highlight.TokenSources; import org.apache.lucene.search.Query; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import java.io.IOException; Index: lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40StoredFieldsWriter.java =================================================================== --- lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40StoredFieldsWriter.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/codecs/lucene40/Lucene40StoredFieldsWriter.java (working copy) @@ -22,7 +22,6 @@ import org.apache.lucene.codecs.StoredFieldsReader; import org.apache.lucene.codecs.StoredFieldsWriter; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.AtomicReader; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfos; @@ -31,6 +30,7 @@ import org.apache.lucene.index.MergeState; import org.apache.lucene.index.SegmentReader; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; Index: lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsWriter.java =================================================================== --- lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsWriter.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/codecs/StoredFieldsWriter.java (working copy) @@ -1,17 +1,5 @@ package org.apache.lucene.codecs; -import java.io.Closeable; -import java.io.IOException; - -import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; -import org.apache.lucene.index.FieldInfo; -import org.apache.lucene.index.FieldInfos; -import org.apache.lucene.index.IndexableField; -import org.apache.lucene.index.MergeState; -import org.apache.lucene.index.StorableField; -import org.apache.lucene.util.Bits; - /** * Copyright 2004 The Apache Software Foundation * @@ -31,13 +19,13 @@ import java.io.Closeable; import java.io.IOException; -import org.apache.lucene.document.Document; -import org.apache.lucene.index.AtomicReader; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.FieldInfos; -import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.MergeState; +import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.util.Bits; +import org.apache.lucene.index.AtomicReader; /** * Codec API for writing stored fields: Index: lucene/core/src/java/org/apache/lucene/document/Document.java =================================================================== --- lucene/core/src/java/org/apache/lucene/document/Document.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/document/Document.java (working copy) @@ -23,6 +23,7 @@ import org.apache.lucene.index.IndexReader; // for javadoc import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.IndexSearcher; // for javadoc import org.apache.lucene.search.ScoreDoc; // for javadoc import org.apache.lucene.util.BytesRef; @@ -50,7 +51,31 @@ /** Constructs a new document with no fields. */ public Document() {} + /** + * Creates a Document from StoredDocument so it that can be used e.g. for another + * round of indexing. + * + * @return a new instance of Document representation of this StoredDocument + */ + public Document(StoredDocument storedDoc) { + for (StorableField field : storedDoc.getFields()) { + Field newField = new Field(field.name(), (FieldType) field.fieldType()); + + newField.fieldsData = field.stringValue(); + if (newField.fieldsData == null) + newField.fieldsData = field.numericValue(); + if (newField.fieldsData == null) + newField.fieldsData = field.binaryValue(); + if (newField.fieldsData == null) + newField.fieldsData = field.readerValue(); + + add(newField); + } + } + + + /** *

Adds a field to a document. Several fields may be added with * the same name. In this case, if the fields are indexed, their text is * treated as though appended for the purposes of search.

@@ -64,14 +89,6 @@ fields.add(field); } - public final void add(IndexableField field) { - fields.add((Field) field); - } - - public final void add(StorableField field) { - fields.add((Field) field); - } - /** *

Removes field with the specified name from the document. * If multiple fields exist with this name, this method removes the first field that has been added. @@ -167,8 +184,8 @@ * null. If multiple fields exists with this name, this method returns the * first value added. */ - public final IndexableField getField(String name) { - for (IndexableField field : fields) { + public final Field getField(String name) { + for (Field field : fields) { if (field.name().equals(name)) { return field; } @@ -184,15 +201,15 @@ * @param name the name of the field * @return a Fieldable[] array */ - public IndexableField[] getFields(String name) { - List result = new ArrayList(); - for (IndexableField field : fields) { + public Field[] getFields(String name) { + List result = new ArrayList(); + for (Field field : fields) { if (field.name().equals(name)) { result.add(field); } } - return result.toArray(new IndexableField[result.size()]); + return result.toArray(new Field[result.size()]); } /** Returns a List of all the fields in a document. @@ -200,14 +217,11 @@ * not available in documents retrieved from the * index, e.g. {@link IndexSearcher#doc(int)} or {@link * IndexReader#document(int)}. + * + * @return an immutable List[Field] */ - public final List getFields() { - List result = new ArrayList(); - for (IndexableField field : fields) { - result.add(field); - } - - return result; + public final List getFields() { + return Collections.unmodifiableList(fields); } private final static String[] NO_STRINGS = new String[0]; @@ -275,6 +289,7 @@ return buffer.toString(); } + /** Obtains all indexed fields in document */ @Override public Iterable indexableFields() { Iterator it = indexedFieldsIterator(); @@ -287,6 +302,8 @@ return result; } + + /** Obtains all stored fields in document. */ @Override public Iterable storableFields() { Iterator it = storedFieldsIterator(); @@ -299,7 +316,7 @@ return result; } - public Iterator storedFieldsIterator() { + private Iterator storedFieldsIterator() { return new FilterIterator(fields.iterator()) { @Override protected boolean predicateFunction(Field field) { @@ -308,7 +325,7 @@ }; } - public Iterator indexedFieldsIterator() { + private Iterator indexedFieldsIterator() { return new FilterIterator(fields.iterator()) { @Override protected boolean predicateFunction(Field field) { @@ -316,4 +333,9 @@ } }; } + + /** Removes all the fields from document. */ + public void clear() { + fields.clear(); + } } Index: lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java =================================================================== --- lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/document/DocumentStoredFieldVisitor.java (working copy) @@ -23,6 +23,7 @@ import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.StoredFieldVisitor; /** A {@link StoredFieldVisitor} that creates a {@link Index: lucene/core/src/java/org/apache/lucene/document/StoredField.java =================================================================== --- lucene/core/src/java/org/apache/lucene/document/StoredField.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/document/StoredField.java (working copy) @@ -1,6 +1,7 @@ package org.apache.lucene.document; import org.apache.lucene.index.IndexReader; // javadocs +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.IndexSearcher; // javadocs import org.apache.lucene.util.BytesRef; Index: lucene/core/src/java/org/apache/lucene/index/CheckIndex.java =================================================================== --- lucene/core/src/java/org/apache/lucene/index/CheckIndex.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/index/CheckIndex.java (working copy) @@ -32,7 +32,6 @@ import org.apache.lucene.codecs.Codec; import org.apache.lucene.document.Document; import org.apache.lucene.document.FieldType; // for javadocs -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DocValues.SortedSource; import org.apache.lucene.index.DocValues.Source; import org.apache.lucene.index.FieldInfo.IndexOptions; Index: lucene/core/src/java/org/apache/lucene/index/GeneralField.java =================================================================== --- lucene/core/src/java/org/apache/lucene/index/GeneralField.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/index/GeneralField.java (working copy) @@ -1,9 +1,5 @@ package org.apache.lucene.index; -import java.io.Reader; - -import org.apache.lucene.util.BytesRef; - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -29,16 +25,4 @@ /** {@link IndexableFieldType} describing the properties * of this field. */ public IndexableFieldType fieldType(); - - /** Non-null if this field has a binary value */ - public BytesRef binaryValue(); - - /** Non-null if this field has a string value */ - public String stringValue(); - - /** Non-null if this field has a Reader value */ - public Reader readerValue(); - - /** Non-null if this field has a numeric value */ - public Number numericValue(); } Index: lucene/core/src/java/org/apache/lucene/index/IndexDocument.java =================================================================== --- lucene/core/src/java/org/apache/lucene/index/IndexDocument.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/index/IndexDocument.java (working copy) @@ -21,6 +21,10 @@ * @lucene.internal */ public interface IndexDocument { + + /** Obtains all indexable fields in document */ public Iterable indexableFields(); + + /** Obtains all storable fields in document */ public Iterable storableFields(); } Index: lucene/core/src/java/org/apache/lucene/index/IndexReader.java =================================================================== --- lucene/core/src/java/org/apache/lucene/index/IndexReader.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/index/IndexReader.java (working copy) @@ -27,7 +27,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.DocumentStoredFieldVisitor; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.search.SearcherManager; // javadocs import org.apache.lucene.store.AlreadyClosedException; import org.apache.lucene.util.Bits; Index: lucene/core/src/java/org/apache/lucene/index/Norm.java =================================================================== --- lucene/core/src/java/org/apache/lucene/index/Norm.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/index/Norm.java (working copy) @@ -33,7 +33,7 @@ import org.apache.lucene.util.BytesRef; /** - * Stores the normalization value computed in + * Stores the normalization value with {@link StorableField} computed in * {@link Similarity#computeNorm(FieldInvertState, Norm)} per field. * Normalization values must be consistent within a single field, different * value types are not permitted within a single field. All values set must be @@ -48,9 +48,9 @@ private BytesRef spare; /** - * Returns the {@link IndexableField} representation for this norm + * Returns the {@link StorableField} representation for this norm */ - public StoredField field() { + public StorableField field() { return field; } Index: lucene/core/src/java/org/apache/lucene/index/PersistentSnapshotDeletionPolicy.java =================================================================== --- lucene/core/src/java/org/apache/lucene/index/PersistentSnapshotDeletionPolicy.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/index/PersistentSnapshotDeletionPolicy.java (working copy) @@ -26,7 +26,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.store.Directory; @@ -73,9 +72,9 @@ if (doc.getField(SNAPSHOTS_ID) == null) { throw new IllegalStateException("directory is not a valid snapshots store!"); } - doc.removeField(SNAPSHOTS_ID); for (StorableField f : doc) { - snapshots.put(f.name(), f.stringValue()); + if (!f.name().equals(SNAPSHOTS_ID)) + snapshots.put(f.name(), f.stringValue()); } } else if (numDocs != 0) { throw new IllegalStateException( Index: lucene/core/src/java/org/apache/lucene/index/StorableField.java =================================================================== --- lucene/core/src/java/org/apache/lucene/index/StorableField.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/index/StorableField.java (working copy) @@ -1,10 +1,5 @@ package org.apache.lucene.index; -import java.io.Reader; - -import org.apache.lucene.document.FieldType; -import org.apache.lucene.util.BytesRef; - /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -22,6 +17,21 @@ * limitations under the License. */ +import java.io.Reader; + +import org.apache.lucene.util.BytesRef; + public interface StorableField extends GeneralField { - + + /** Non-null if this field has a binary value */ + public BytesRef binaryValue(); + + /** Non-null if this field has a string value */ + public String stringValue(); + + /** Non-null if this field has a Reader value */ + public Reader readerValue(); + + /** Non-null if this field has a numeric value */ + public Number numericValue(); } Index: lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java =================================================================== --- lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java (revision 1371227) +++ lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java (working copy) @@ -33,13 +33,13 @@ import java.util.concurrent.locks.ReentrantLock; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.DirectoryReader; // javadocs import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.IndexReaderContext; import org.apache.lucene.index.ReaderUtil; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.StoredFieldVisitor; import org.apache.lucene.index.Term; import org.apache.lucene.index.TermContext; Index: lucene/core/src/test/org/apache/lucene/codecs/appending/TestAppendingCodec.java =================================================================== --- lucene/core/src/test/org/apache/lucene/codecs/appending/TestAppendingCodec.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/codecs/appending/TestAppendingCodec.java (working copy) @@ -24,7 +24,6 @@ import org.apache.lucene.codecs.appending.AppendingCodec; import org.apache.lucene.document.Document; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.DocsEnum; @@ -33,6 +32,7 @@ import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.MultiFields; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum.SeekStatus; import org.apache.lucene.index.TermsEnum; Index: lucene/core/src/test/org/apache/lucene/document/TestBinaryDocument.java =================================================================== --- lucene/core/src/test/org/apache/lucene/document/TestBinaryDocument.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/document/TestBinaryDocument.java (working copy) @@ -3,6 +3,7 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.LuceneTestCase; Index: lucene/core/src/test/org/apache/lucene/document/TestDocument.java =================================================================== --- lucene/core/src/test/org/apache/lucene/document/TestDocument.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/document/TestDocument.java (working copy) @@ -18,6 +18,7 @@ */ import java.io.StringReader; +import java.util.List; import org.apache.lucene.analysis.EmptyTokenizer; import org.apache.lucene.analysis.MockAnalyzer; @@ -27,6 +28,8 @@ import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; @@ -124,7 +127,7 @@ // siltenlty ignored assertEquals(0, doc.getFields().size()); } - + public void testConstructorExceptions() { FieldType ft = new FieldType(); ft.setStored(true); @@ -147,6 +150,34 @@ // expected exception } } + + public void testClearDocument() { + Document doc = makeDocumentWithFields(); + assertEquals(8, doc.getFields().size()); + doc.clear(); + assertEquals(0, doc.getFields().size()); + } + + public void testGetFieldsImmutable() { + Document doc = makeDocumentWithFields(); + assertEquals(8, doc.getFields().size()); + List fields = doc.getFields(); + try { + fields.add( new StringField("name", "value", Field.Store.NO) ); + fail("Document.getFields() should return immutable List"); + } + catch (UnsupportedOperationException e) { + // OK + } + + try { + fields.clear(); + fail("Document.getFields() should return immutable List"); + } + catch (UnsupportedOperationException e) { + // OK + } + } /** * Tests {@link Document#getValues(String)} method for a brand new Document @@ -215,13 +246,13 @@ } private void doAssert(StoredDocument doc) { - doAssert(doc.asIndexable(), true); + doAssert(new Document(doc), true); } private void doAssert(Document doc, boolean fromIndex) { - IndexableField[] keywordFieldValues = doc.getFields("keyword"); - IndexableField[] textFieldValues = doc.getFields("text"); - IndexableField[] unindexedFieldValues = doc.getFields("unindexed"); - IndexableField[] unstoredFieldValues = doc.getFields("unstored"); + StorableField[] keywordFieldValues = doc.getFields("keyword"); + StorableField[] textFieldValues = doc.getFields("text"); + StorableField[] unindexedFieldValues = doc.getFields("unindexed"); + StorableField[] unstoredFieldValues = doc.getFields("unstored"); assertTrue(keywordFieldValues.length == 2); assertTrue(textFieldValues.length == 2); Index: lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java (working copy) @@ -45,7 +45,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexWriterConfig.OpenMode; Index: lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (working copy) @@ -43,7 +43,6 @@ import org.apache.lucene.document.PackedLongDocValuesField; import org.apache.lucene.document.ShortDocValuesField; import org.apache.lucene.document.SortedBytesDocValuesField; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StraightBytesDocValuesField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; Index: lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestCustomNorms.java (working copy) @@ -22,7 +22,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DocValues.Source; import org.apache.lucene.index.DocValues.Type; Index: lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestDirectoryReader.java (working copy) @@ -32,7 +32,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StoredField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; Index: lucene/core/src/test/org/apache/lucene/index/TestDirectoryReaderReopen.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestDirectoryReaderReopen.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestDirectoryReaderReopen.java (working copy) @@ -32,7 +32,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.search.IndexSearcher; Index: lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java (working copy) @@ -27,7 +27,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.FieldInfo.IndexOptions; Index: lucene/core/src/test/org/apache/lucene/index/TestDocValuesTypeCompatibility.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestDocValuesTypeCompatibility.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestDocValuesTypeCompatibility.java (working copy) @@ -24,6 +24,7 @@ import org.apache.lucene.document.DerefBytesDocValuesField; import org.apache.lucene.document.Document; import org.apache.lucene.document.DoubleDocValuesField; +import org.apache.lucene.document.Field; import org.apache.lucene.document.FloatDocValuesField; import org.apache.lucene.document.IntDocValuesField; import org.apache.lucene.document.LongDocValuesField; @@ -67,7 +68,7 @@ } @SuppressWarnings("fallthrough") - public IndexableField getRandomIntsField(Type maxType, boolean force) { + public Field getRandomIntsField(Type maxType, boolean force) { switch (maxType) { case VAR_INTS: @@ -120,7 +121,7 @@ } @SuppressWarnings("fallthrough") - public IndexableField getRandomFloatField(Type maxType, boolean force) { + public Field getRandomFloatField(Type maxType, boolean force) { switch (maxType) { case FLOAT_64: @@ -161,7 +162,7 @@ iwc.setRAMBufferSizeMB(IndexWriterConfig.DISABLE_AUTO_FLUSH); iwc.setRAMPerThreadHardLimitMB(2000); IndexWriter writer = new IndexWriter(dir, iwc); - IndexableField[] fields = new IndexableField[] { + Field[] fields = new Field[] { new DoubleDocValuesField("f", 1.0), new IntDocValuesField("f", 1), new ShortDocValuesField("f", (short) 1), new ByteDocValuesField("f", (byte) 1)}; @@ -194,7 +195,7 @@ IndexWriter writer = new IndexWriter(dir, iwc); boolean mustBeFixed = random().nextBoolean(); int maxSize = 2 + random().nextInt(15); - IndexableField bytesField = getRandomBytesField(mustBeFixed, maxSize, + Field bytesField = getRandomBytesField(mustBeFixed, maxSize, true); addDoc(writer, bytesField); for (int j = 0; j < numDocs; j++) { @@ -207,7 +208,7 @@ } } - public IndexableField getRandomBytesField(boolean mustBeFixed, int maxSize, + public Field getRandomBytesField(boolean mustBeFixed, int maxSize, boolean mustBeVariableIfNotFixed) { int size = mustBeFixed ? maxSize : random().nextInt(maxSize) + 1; StringBuilder s = new StringBuilder(); @@ -256,16 +257,16 @@ dir.close(); } - private void addDoc(IndexWriter writer, IndexableField... fields) + private void addDoc(IndexWriter writer, Field... fields) throws IOException { Document doc = new Document(); - for (IndexableField indexableField : fields) { + for (Field indexableField : fields) { doc.add(indexableField); } writer.addDocument(doc); } - public IndexableField getRandomIndexableDVField() { + public Field getRandomIndexableDVField() { int size = random().nextInt(100) + 1; StringBuilder s = new StringBuilder(); for (int i = 0; i < size; i++) { Index: lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestDuelingCodecs.java (working copy) @@ -31,7 +31,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.codecs.Codec; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.TermsEnum.SeekStatus; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.store.Directory; Index: lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java (working copy) @@ -31,7 +31,6 @@ import org.apache.lucene.document.FloatField; import org.apache.lucene.document.IntField; import org.apache.lucene.document.LongField; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StoredField; import org.apache.lucene.document.StringField; import org.apache.lucene.index.FieldInfo.IndexOptions; Index: lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java (working copy) @@ -25,7 +25,6 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DocValues.Type; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; Index: lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java (working copy) @@ -34,7 +34,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StoredField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; Index: lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java (working copy) @@ -1556,50 +1556,46 @@ try { doc = new Document(); // try to boost with norms omitted - List list = new ArrayList(); - list.add(new IndexableField() { - + IndexDocument docList = new IndexDocument() { + + List list = new ArrayList(); + List storedList = new ArrayList(); + @Override - public String name() { - return "foo"; - } + public Iterable indexableFields() { + if (list.size() == 0) { + list.add(new IndexableField() { + @Override + public String name() { + return "foo"; + } - @Override - public IndexableFieldType fieldType() { - return StringField.TYPE_NOT_STORED; - } + @Override + public IndexableFieldType fieldType() { + return StringField.TYPE_NOT_STORED; + } - @Override - public float boost() { - return 5f; - } + @Override + public float boost() { + return 5f; + } - @Override - public BytesRef binaryValue() { - return null; + @Override + public TokenStream tokenStream(Analyzer analyzer) throws IOException { + return null; + } + }); + } + return list; } @Override - public String stringValue() { - return "baz"; + public Iterable storableFields() { + return storedList; } - - @Override - public Reader readerValue() { - return null; - } - - @Override - public Number numericValue() { - return null; - } - - @Override - public TokenStream tokenStream(Analyzer analyzer) throws IOException { - return null; - } - }); - iw.addDocument(list); + + }; + iw.addDocument(docList); fail("didn't get any exception, boost silently discarded"); } catch (UnsupportedOperationException expected) { // expected Index: lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMerging.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMerging.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestIndexWriterMerging.java (working copy) @@ -21,7 +21,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.util.LuceneTestCase; Index: lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestIndexWriterReader.java (working copy) @@ -28,7 +28,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.IndexSearcher; @@ -142,10 +141,10 @@ String id10 = r1.document(10).getField("id").stringValue(); - StoredDocument newDoc = r1.document(10); + Document newDoc = new Document(r1.document(10)); newDoc.removeField("id"); newDoc.add(newStringField("id", Integer.toString(8000), Field.Store.YES)); - writer.updateDocument(new Term("id", id10), newDoc.asIndexable()); + writer.updateDocument(new Term("id", id10), newDoc); assertFalse(r1.isCurrent()); DirectoryReader r2 = writer.getReader(); Index: lucene/core/src/test/org/apache/lucene/index/TestIndexWriterUnicode.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestIndexWriterUnicode.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestIndexWriterUnicode.java (working copy) @@ -26,7 +26,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRef; Index: lucene/core/src/test/org/apache/lucene/index/TestNorms.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestNorms.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestNorms.java (working copy) @@ -23,7 +23,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DocValues.Source; import org.apache.lucene.index.DocValues.Type; Index: lucene/core/src/test/org/apache/lucene/index/TestParallelAtomicReader.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestParallelAtomicReader.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestParallelAtomicReader.java (working copy) @@ -23,7 +23,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.*; import org.apache.lucene.store.Directory; Index: lucene/core/src/test/org/apache/lucene/index/TestParallelCompositeReader.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestParallelCompositeReader.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestParallelCompositeReader.java (working copy) @@ -23,7 +23,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.*; import org.apache.lucene.store.Directory; Index: lucene/core/src/test/org/apache/lucene/index/TestRandomStoredFields.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestRandomStoredFields.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestRandomStoredFields.java (working copy) @@ -29,7 +29,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.TermQuery; Index: lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestSegmentMerger.java (working copy) @@ -21,7 +21,6 @@ import org.apache.lucene.codecs.Codec; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; Index: lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java (working copy) @@ -23,7 +23,6 @@ import java.util.List; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; Index: lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java (working copy) @@ -32,7 +32,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.search.DocIdSetIterator; @@ -251,7 +250,7 @@ Iterator iter = docs.values().iterator(); while (iter.hasNext()) { Document d = iter.next(); - ArrayList fields = new ArrayList(); + ArrayList fields = new ArrayList(); fields.addAll(d.getFields()); // put fields in same order each time Collections.sort(fields, fieldNameComparator); Index: lucene/core/src/test/org/apache/lucene/index/TestStressNRT.java =================================================================== --- lucene/core/src/test/org/apache/lucene/index/TestStressNRT.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/index/TestStressNRT.java (working copy) @@ -30,7 +30,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.ScoreDoc; Index: lucene/core/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java (working copy) @@ -20,7 +20,6 @@ import java.io.IOException; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.analysis.MockAnalyzer; @@ -29,6 +28,7 @@ import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.search.*; import org.apache.lucene.search.similarities.DefaultSimilarity; Index: lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (working copy) @@ -18,11 +18,11 @@ */ import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.document.Document; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.store.Directory; import org.junit.AfterClass; Index: lucene/core/src/test/org/apache/lucene/search/TestDateSort.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestDateSort.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/TestDateSort.java (working copy) @@ -25,9 +25,9 @@ import org.apache.lucene.document.DateTools; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.store.Directory; /** Index: lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (working copy) @@ -22,7 +22,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.IndexReader; @@ -30,6 +29,7 @@ import org.apache.lucene.index.SlowCompositeReaderWrapper; import org.apache.lucene.index.FieldInvertState; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.search.similarities.DefaultSimilarity; import org.apache.lucene.search.similarities.Similarity; Index: lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (working copy) @@ -23,13 +23,13 @@ import org.apache.lucene.document.FieldType; import org.apache.lucene.document.FloatField; import org.apache.lucene.document.IntField; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.SlowCompositeReaderWrapper; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.store.Directory; Index: lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (working copy) @@ -23,13 +23,13 @@ import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; import org.apache.lucene.document.LongField; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.SlowCompositeReaderWrapper; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.store.Directory; Index: lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/TestPhraseQuery.java (working copy) @@ -74,7 +74,7 @@ Document doc = new Document(); doc.add(newTextField("field", "one two three four five", Field.Store.YES)); doc.add(newTextField("repeated", "this is a repeated field - first part", Field.Store.YES)); - IndexableField repeatedField = newTextField("repeated", "second part of a repeated field", Field.Store.YES); + Field repeatedField = newTextField("repeated", "second part of a repeated field", Field.Store.YES); doc.add(repeatedField); doc.add(newTextField("palindrome", "one two three two one", Field.Store.YES)); writer.addDocument(doc); Index: lucene/core/src/test/org/apache/lucene/search/TestSort.java =================================================================== --- lucene/core/src/test/org/apache/lucene/search/TestSort.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/search/TestSort.java (working copy) @@ -38,7 +38,6 @@ import org.apache.lucene.document.FloatDocValuesField; import org.apache.lucene.document.PackedLongDocValuesField; import org.apache.lucene.document.SortedBytesDocValuesField; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StraightBytesDocValuesField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; @@ -52,6 +51,7 @@ import org.apache.lucene.index.MultiReader; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause.Occur; import org.apache.lucene.search.FieldValueHitQueue.Entry; Index: lucene/core/src/test/org/apache/lucene/store/TestRAMDirectory.java =================================================================== --- lucene/core/src/test/org/apache/lucene/store/TestRAMDirectory.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/store/TestRAMDirectory.java (working copy) @@ -21,7 +21,6 @@ import java.io.IOException; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util._TestUtil; import org.apache.lucene.analysis.MockAnalyzer; @@ -30,6 +29,7 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.util.English; Index: lucene/core/src/test/org/apache/lucene/TestDemo.java =================================================================== --- lucene/core/src/test/org/apache/lucene/TestDemo.java (revision 1371227) +++ lucene/core/src/test/org/apache/lucene/TestDemo.java (working copy) @@ -23,9 +23,9 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.index.RandomIndexWriter; import org.apache.lucene.search.*; Index: lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java =================================================================== --- lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java (revision 1371227) +++ lucene/demo/src/java/org/apache/lucene/demo/SearchFiles.java (working copy) @@ -27,9 +27,9 @@ import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; Index: lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java =================================================================== --- lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (revision 1371227) +++ lucene/demo/src/java/org/apache/lucene/demo/xmlparser/FormBasedXmlQueryDemo.java (working copy) @@ -36,12 +36,12 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.queryparser.xml.CorePlusExtensionsParser; import org.apache.lucene.queryparser.xml.QueryTemplateManager; import org.apache.lucene.search.IndexSearcher; Index: lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java =================================================================== --- lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (revision 1371227) +++ lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java (working copy) @@ -594,7 +594,7 @@ Document doc = new Document(); docs.add(doc); if (groupValue.group != null) { - doc.add(newStringField("group", groupValue.group.utf8ToString(), Field.Store.NO)); + doc.add(newStringField("group", groupValue.group.utf8ToString(), Field.Store.YES)); } doc.add(newStringField("sort1", groupValue.sort1.utf8ToString(), Field.Store.NO)); doc.add(newStringField("sort2", groupValue.sort2.utf8ToString(), Field.Store.NO)); Index: lucene/highlighter/src/java/org/apache/lucene/search/highlight/TokenSources.java =================================================================== --- lucene/highlighter/src/java/org/apache/lucene/search/highlight/TokenSources.java (revision 1371227) +++ lucene/highlighter/src/java/org/apache/lucene/search/highlight/TokenSources.java (working copy) @@ -32,10 +32,10 @@ import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DocsAndPositionsEnum; import org.apache.lucene.index.Fields; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.DocIdSetIterator; Index: lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java =================================================================== --- lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (revision 1371227) +++ lucene/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterTest.java (working copy) @@ -37,12 +37,12 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.IntField; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StoredField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.IndexWriterConfig.OpenMode; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.Term; Index: lucene/misc/src/java/org/apache/lucene/document/LazyDocument.java =================================================================== --- lucene/misc/src/java/org/apache/lucene/document/LazyDocument.java (revision 1371227) +++ lucene/misc/src/java/org/apache/lucene/document/LazyDocument.java (working copy) @@ -27,6 +27,7 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexableFieldType; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.util.BytesRef; /** Defers actually loading a field's value until you ask Index: lucene/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java =================================================================== --- lucene/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java (revision 1371227) +++ lucene/misc/src/test/org/apache/lucene/index/TestMultiPassIndexSplitter.java (working copy) @@ -19,7 +19,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.store.Directory; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.LuceneTestCase; Index: lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java =================================================================== --- lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java (revision 1371227) +++ lucene/queries/src/java/org/apache/lucene/queries/mlt/MoreLikeThis.java (working copy) @@ -22,12 +22,12 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.Fields; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.MultiFields; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.index.Terms; import org.apache.lucene.index.TermsEnum; Index: lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java =================================================================== --- lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java (revision 1371227) +++ lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java (working copy) @@ -23,10 +23,10 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; Index: lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java =================================================================== --- lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java (revision 1371227) +++ lucene/queryparser/src/test/org/apache/lucene/queryparser/xml/TestParser.java (working copy) @@ -24,11 +24,11 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.IntField; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.DisjunctionMaxQuery; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; Index: lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java =================================================================== --- lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java (revision 1371227) +++ lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/DuplicateFilterTest.java (working copy) @@ -23,7 +23,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.*; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.IndexSearcher; Index: lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/FuzzyLikeThisQueryTest.java =================================================================== --- lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/FuzzyLikeThisQueryTest.java (revision 1371227) +++ lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/FuzzyLikeThisQueryTest.java (working copy) @@ -21,9 +21,9 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; Index: lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java (revision 1371227) +++ lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java (working copy) @@ -92,11 +92,11 @@ //--------------------------------- @Override - public IndexableField[] createIndexableFields(Shape shape) { + public Field[] createIndexableFields(Shape shape) { Rectangle bbox = shape.getBoundingBox(); FieldType doubleFieldType = new FieldType(DoubleField.TYPE_NOT_STORED); doubleFieldType.setNumericPrecisionStep(precisionStep); - IndexableField[] fields = new IndexableField[5]; + Field[] fields = new Field[5]; fields[0] = new DoubleField(field_minX, bbox.getMinX(), doubleFieldType); fields[1] = new DoubleField(field_maxX, bbox.getMaxX(), doubleFieldType); fields[2] = new DoubleField(field_minY, bbox.getMinY(), doubleFieldType); Index: lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java (revision 1371227) +++ lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java (working copy) @@ -63,7 +63,7 @@ } @Override - public IndexableField[] createIndexableFields(Shape shape) { + public Field[] createIndexableFields(Shape shape) { int detailLevel = grid.getMaxLevelForPrecision(shape,distErrPct); List cells = grid.getNodes(shape, detailLevel, true);//true=intermediates cells //If shape isn't a point, add a full-resolution center-point so that @@ -79,7 +79,7 @@ // http://code.google.com/p/lucene-spatial-playground/issues/detail?id=4 Field field = new Field(getFieldName(), new CellTokenStream(cells.iterator()), FIELD_TYPE); - return new IndexableField[]{field}; + return new Field[]{field}; } /* Indexed, tokenized, not stored. */ Index: lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java (revision 1371227) +++ lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java (working copy) @@ -19,6 +19,8 @@ import com.spatial4j.core.context.SpatialContext; import com.spatial4j.core.shape.Shape; + +import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexableField; import org.apache.lucene.queries.function.FunctionQuery; import org.apache.lucene.queries.function.ValueSource; @@ -97,7 +99,7 @@ * * @return Not null nor will it have null elements. */ - public abstract IndexableField[] createIndexableFields(Shape shape); + public abstract Field[] createIndexableFields(Shape shape); /** * The value source yields a number that is proportional to the distance between the query shape and indexed data. Index: lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java (revision 1371227) +++ lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java (working copy) @@ -24,6 +24,7 @@ import com.spatial4j.core.shape.Rectangle; import com.spatial4j.core.shape.Shape; import org.apache.lucene.document.DoubleField; +import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; import org.apache.lucene.index.IndexableField; import org.apache.lucene.queries.function.FunctionQuery; @@ -77,12 +78,12 @@ } @Override - public IndexableField[] createIndexableFields(Shape shape) { + public Field[] createIndexableFields(Shape shape) { if( shape instanceof Point ) { Point point = (Point)shape; FieldType doubleFieldType = new FieldType(DoubleField.TYPE_NOT_STORED); doubleFieldType.setNumericPrecisionStep(precisionStep); - IndexableField[] f = new IndexableField[2]; + Field[] f = new Field[2]; f[0] = new DoubleField(fieldNameX, point.getX(), doubleFieldType); f[1] = new DoubleField(fieldNameY, point.getY(), doubleFieldType); return f; @@ -90,7 +91,7 @@ if( !ignoreIncompatibleGeometry ) { throw new IllegalArgumentException( "TwoDoublesStrategy can not index: "+shape ); } - return new IndexableField[0]; // nothing (solr does not support null) + return new Field[0]; // nothing (solr does not support null) } @Override Index: lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java (revision 1371227) +++ lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java (working copy) @@ -194,7 +194,7 @@ private Document newDoc(String id, Shape shape) { Document doc = new Document(); doc.add(new StringField("id", id, Field.Store.YES)); - for (IndexableField f : strategy.createIndexableFields(shape)) { + for (Field f : strategy.createIndexableFields(shape)) { doc.add(f); } if (storeShape) Index: lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java (revision 1371227) +++ lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestRecursivePrefixTreeStrategy.java (working copy) @@ -154,7 +154,7 @@ private Document newDoc(String id, Shape shape) { Document doc = new Document(); doc.add(new StringField("id", id, Field.Store.YES)); - for (IndexableField f : strategy.createIndexableFields(shape)) { + for (Field f : strategy.createIndexableFields(shape)) { doc.add(f); } if (storeShape) Index: lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java (revision 1371227) +++ lucene/spatial/src/test/org/apache/lucene/spatial/prefix/TestTermQueryPrefixGridStrategy.java (working copy) @@ -46,7 +46,7 @@ Document losAngeles = new Document(); losAngeles.add(new StringField("name", "Los Angeles", Field.Store.YES)); - for (IndexableField field : prefixGridStrategy.createIndexableFields(point)) { + for (Field field : prefixGridStrategy.createIndexableFields(point)) { losAngeles.add(field); } losAngeles.add(new StoredField(prefixGridStrategy.getFieldName(), ctx.toString(point))); Index: lucene/spatial/src/test/org/apache/lucene/spatial/SpatialExample.java =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/SpatialExample.java (revision 1371227) +++ lucene/spatial/src/test/org/apache/lucene/spatial/SpatialExample.java (working copy) @@ -124,7 +124,7 @@ //Potentially more than one shape in this field is supported by some // strategies; see the javadocs of the SpatialStrategy impl to see. for (Shape shape : shapes) { - for (IndexableField f : strategy.createIndexableFields(shape)) { + for (Field f : strategy.createIndexableFields(shape)) { doc.add(f); } //store it too; the format is up to you Index: lucene/spatial/src/test/org/apache/lucene/spatial/SpatialTestCase.java =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/SpatialTestCase.java (revision 1371227) +++ lucene/spatial/src/test/org/apache/lucene/spatial/SpatialTestCase.java (working copy) @@ -18,9 +18,9 @@ package org.apache.lucene.spatial; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; import org.apache.lucene.search.ScoreDoc; Index: lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java (revision 1371227) +++ lucene/spatial/src/test/org/apache/lucene/spatial/StrategyTestCase.java (working copy) @@ -85,7 +85,7 @@ document.add(new StringField("id", data.id, Field.Store.YES)); document.add(new StringField("name", data.name, Field.Store.YES)); Shape shape = ctx.readShape(data.shape); - for (IndexableField f : strategy.createIndexableFields(shape)) { + for (Field f : strategy.createIndexableFields(shape)) { document.add(f); } if (storeShape) Index: lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java =================================================================== --- lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java (revision 1371227) +++ lucene/test-framework/src/java/org/apache/lucene/analysis/CollationTestBase.java (working copy) @@ -27,7 +27,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; @@ -36,6 +35,7 @@ import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Query; Index: lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java =================================================================== --- lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java (revision 1371227) +++ lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java (working copy) @@ -29,7 +29,6 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.document.StoredField; import org.apache.lucene.document.StringField; import org.apache.lucene.document.TextField; Index: lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java =================================================================== --- lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java (revision 1371227) +++ lucene/test-framework/src/java/org/apache/lucene/index/ThreadedIndexingAndSearchingTestCase.java (working copy) @@ -29,7 +29,6 @@ import org.apache.lucene.analysis.MockAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.PhraseQuery; import org.apache.lucene.search.Query; Index: solr/contrib/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java =================================================================== --- solr/contrib/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java (revision 1371227) +++ solr/contrib/analysis-extras/src/java/org/apache/solr/schema/ICUCollationField.java (working copy) @@ -29,6 +29,7 @@ import org.apache.lucene.collation.ICUCollationKeyAnalyzer; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.Query; import org.apache.lucene.search.SortField; import org.apache.lucene.search.TermRangeQuery; @@ -211,7 +212,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeStr(name, f.stringValue(), true); } Index: solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java =================================================================== --- solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (working copy) @@ -28,7 +28,6 @@ import org.apache.lucene.analysis.util.TokenizerFactory; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.*; import org.apache.lucene.index.FieldInfo.IndexOptions; import org.apache.lucene.search.DocIdSetIterator; Index: solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java =================================================================== --- solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/handler/component/RealTimeGetComponent.java (working copy) @@ -18,9 +18,9 @@ */ import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.util.BytesRef; import org.apache.solr.client.solrj.SolrResponse; @@ -298,7 +298,6 @@ private static SolrDocument toSolrDoc(SolrInputDocument sdoc, IndexSchema schema) { // TODO: do something more performant than this double conversion Document doc = DocumentBuilder.toDocument(sdoc, schema); - List fields = doc.getFields(); // copy the stored fields only StoredDocument out = new StoredDocument(); Index: solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java =================================================================== --- solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/handler/MoreLikeThisHandler.java (working copy) @@ -30,8 +30,8 @@ import java.util.regex.Pattern; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.search.*; Index: solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java =================================================================== --- solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java (working copy) @@ -33,9 +33,9 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.Query; import org.apache.lucene.search.highlight.*; import org.apache.lucene.search.vectorhighlight.BoundaryScanner; Index: solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java =================================================================== --- solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/response/BinaryResponseWriter.java (working copy) @@ -20,9 +20,9 @@ import java.util.*; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.util.BytesRef; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.params.CommonParams; Index: solr/core/src/java/org/apache/solr/response/TextResponseWriter.java =================================================================== --- solr/core/src/java/org/apache/solr/response/TextResponseWriter.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/response/TextResponseWriter.java (working copy) @@ -22,9 +22,9 @@ import java.util.*; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.util.BytesRef; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; Index: solr/core/src/java/org/apache/solr/schema/BCDIntField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/BCDIntField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/BCDIntField.java (working copy) @@ -21,6 +21,7 @@ import org.apache.lucene.search.SortField; import org.apache.solr.search.QParser; import org.apache.lucene.index.GeneralField; +import org.apache.lucene.index.StorableField; import org.apache.solr.util.BCDUtils; import org.apache.solr.response.TextResponseWriter; @@ -46,13 +47,13 @@ } @Override - public String toExternal(GeneralField f) { + public String toExternal(StorableField f) { return indexedToReadable(f.stringValue()); } // Note, this can't return type 'Integer' because BCDStrField and BCDLong extend it @Override - public Object toObject(GeneralField f) { + public Object toObject(StorableField f) { return Integer.valueOf( toExternal(f) ); } @@ -62,7 +63,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeInt(name,toExternal(f)); } } Index: solr/core/src/java/org/apache/solr/schema/BCDLongField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/BCDLongField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/BCDLongField.java (working copy) @@ -17,13 +17,13 @@ package org.apache.solr.schema; -import org.apache.lucene.index.GeneralField; +import org.apache.lucene.index.StorableField; /** * */ public class BCDLongField extends BCDIntField { @Override - public Long toObject(GeneralField f) { + public Long toObject(StorableField f) { return Long.valueOf( toExternal(f) ); } } Index: solr/core/src/java/org/apache/solr/schema/BCDStrField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/BCDStrField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/BCDStrField.java (working copy) @@ -17,7 +17,7 @@ package org.apache.solr.schema; -import org.apache.lucene.index.GeneralField; +import org.apache.lucene.index.StorableField; /** * */ @@ -27,7 +27,7 @@ * is not an integer, it will not survive the base10k conversion! */ @Override - public String toObject(GeneralField f) { + public String toObject(StorableField f) { return toExternal(f); } } Index: solr/core/src/java/org/apache/solr/schema/BinaryField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/BinaryField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/BinaryField.java (working copy) @@ -23,6 +23,7 @@ import org.apache.lucene.document.Field; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.SortField; import org.apache.lucene.util.BytesRef; import org.apache.solr.common.util.Base64; @@ -36,7 +37,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeStr(name, toBase64String(toObject(f)), false); } @@ -47,18 +48,18 @@ @Override - public String toExternal(GeneralField f) { + public String toExternal(StorableField f) { return toBase64String(toObject(f)); } @Override - public ByteBuffer toObject(GeneralField f) { + public ByteBuffer toObject(StorableField f) { BytesRef bytes = f.binaryValue(); return ByteBuffer.wrap(bytes.bytes, bytes.offset, bytes.length); } @Override - public IndexableField createField(SchemaField field, Object val, float boost) { + public StorableField createField(SchemaField field, Object val, float boost) { if (val == null) return null; if (!field.stored()) { log.trace("Ignoring unstored binary field: " + field); Index: solr/core/src/java/org/apache/solr/schema/BoolField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/BoolField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/BoolField.java (working copy) @@ -19,6 +19,7 @@ import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.GeneralField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.SortField; import org.apache.lucene.util.BytesRef; @@ -112,12 +113,12 @@ } @Override - public String toExternal(GeneralField f) { + public String toExternal(StorableField f) { return indexedToReadable(f.stringValue()); } @Override - public Boolean toObject(GeneralField f) { + public Boolean toObject(StorableField f) { return Boolean.valueOf( toExternal(f) ); } @@ -146,7 +147,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeBool(name, f.stringValue().charAt(0) == 'T'); } } Index: solr/core/src/java/org/apache/solr/schema/ByteField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/ByteField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/ByteField.java (working copy) @@ -20,6 +20,7 @@ import org.apache.lucene.queries.function.valuesource.ByteFieldSource; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.SortField; import org.apache.solr.response.TextResponseWriter; @@ -66,7 +67,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { String s = f.stringValue(); // these values may be from a legacy lucene index, which may @@ -91,7 +92,7 @@ } @Override - public Byte toObject(GeneralField f) { + public Byte toObject(StorableField f) { return Byte.valueOf(toExternal(f)); } } Index: solr/core/src/java/org/apache/solr/schema/CollationField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/CollationField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/CollationField.java (working copy) @@ -33,6 +33,7 @@ import org.apache.lucene.collation.CollationKeyAnalyzer; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.Query; import org.apache.lucene.search.SortField; import org.apache.lucene.search.TermRangeQuery; @@ -186,7 +187,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeStr(name, f.stringValue(), true); } Index: solr/core/src/java/org/apache/solr/schema/CurrencyField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/CurrencyField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/CurrencyField.java (working copy) @@ -19,6 +19,7 @@ import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.queries.function.FunctionValues; import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.search.Query; @@ -132,10 +133,10 @@ } @Override - public IndexableField[] createFields(SchemaField field, Object externalVal, float boost) { + public StorableField[] createFields(SchemaField field, Object externalVal, float boost) { CurrencyValue value = CurrencyValue.parse(externalVal.toString(), defaultCurrency); - IndexableField[] f = new IndexableField[field.stored() ? 3 : 2]; + StorableField[] f = new StorableField[field.stored() ? 3 : 2]; SchemaField amountField = getAmountField(field); f[0] = amountField.createField(String.valueOf(value.getAmount()), amountField.indexed() && !amountField.omitNorms() ? boost : 1F); SchemaField currencyField = getCurrencyField(field); @@ -238,12 +239,8 @@ } } - public void write(XMLWriter xmlWriter, String name, IndexableField field) throws IOException { - xmlWriter.writeStr(name, field.stringValue(), false); - } - @Override - public void write(TextResponseWriter writer, String name, GeneralField field) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField field) throws IOException { writer.writeStr(name, field.stringValue(), false); } Index: solr/core/src/java/org/apache/solr/schema/DateField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/DateField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/DateField.java (working copy) @@ -20,6 +20,7 @@ import org.apache.lucene.index.AtomicReaderContext; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.queries.function.docvalues.DocTermsIndexDocValues; import org.apache.lucene.search.Query; import org.apache.lucene.search.SortField; @@ -189,7 +190,7 @@ } } - public IndexableField createField(SchemaField field, Object value, float boost) { + public StorableField createField(SchemaField field, Object value, float boost) { // Convert to a string before indexing if(value instanceof Date) { value = toInternal( (Date)value ) + Z; @@ -214,7 +215,7 @@ } @Override - public String toExternal(GeneralField f) { + public String toExternal(StorableField f) { return indexedToReadable(f.stringValue()); } @@ -223,7 +224,7 @@ } @Override - public Date toObject(GeneralField f) { + public Date toObject(StorableField f) { try { return parseDate( toExternal(f) ); } @@ -238,7 +239,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeDate(name, toExternal(f)); } Index: solr/core/src/java/org/apache/solr/schema/DoubleField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/DoubleField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/DoubleField.java (working copy) @@ -21,6 +21,7 @@ import org.apache.lucene.queries.function.valuesource.DoubleFieldSource; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.SortField; import org.apache.solr.response.TextResponseWriter; import org.apache.solr.search.QParser; @@ -63,7 +64,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { String s = f.stringValue(); // these values may be from a legacy lucene index, which may @@ -89,7 +90,7 @@ @Override - public Double toObject(GeneralField f) { + public Double toObject(StorableField f) { return Double.valueOf(toExternal(f)); } } Index: solr/core/src/java/org/apache/solr/schema/ExternalFileField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/ExternalFileField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/ExternalFileField.java (working copy) @@ -20,6 +20,7 @@ import org.apache.lucene.search.SortField; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.solr.search.function.FileFloatSource; import org.apache.solr.search.QParser; import org.apache.solr.response.TextResponseWriter; @@ -82,7 +83,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { throw new UnsupportedOperationException(); } Index: solr/core/src/java/org/apache/solr/schema/FieldType.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/FieldType.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/FieldType.java (working copy) @@ -237,7 +237,7 @@ * * */ - public IndexableField createField(SchemaField field, Object value, float boost) { + public StorableField createField(SchemaField field, Object value, float boost) { if (!field.indexed() && !field.stored()) { if (log.isTraceEnabled()) log.trace("Ignoring unindexed/unstored field: " + field); @@ -274,7 +274,7 @@ * @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 StorableField createField(String name, String val, org.apache.lucene.document.FieldType type, float boost){ Field f = new Field(name, val, type); f.setBoost(boost); return f; @@ -290,9 +290,9 @@ * @see #createField(SchemaField, Object, float) * @see #isPolyField() */ - public IndexableField[] createFields(SchemaField field, Object value, float boost) { - IndexableField f = createField( field, value, boost); - return f==null ? new IndexableField[]{} : new IndexableField[]{f}; + public StorableField[] createFields(SchemaField field, Object value, float boost) { + StorableField f = createField( field, value, boost); + return f==null ? new StorableField[]{} : new StorableField[]{f}; } protected IndexOptions getIndexOptions(SchemaField field, String internalVal) { @@ -321,7 +321,7 @@ * value * @see #toInternal */ - public String toExternal(GeneralField f) { + public String toExternal(StorableField f) { // currently used in writing XML of the search result (but perhaps // a more efficient toXML(IndexableField f, Writer w) should be used // in the future. @@ -333,14 +333,14 @@ * @see #toInternal * @since solr 1.3 */ - public Object toObject(GeneralField f) { + public Object toObject(StorableField f) { return toExternal(f); // by default use the string } public Object toObject(SchemaField sf, BytesRef term) { final CharsRef ref = new CharsRef(term.length); indexedToReadable(term, ref); - final IndexableField f = createField(sf, ref.toString(), 1.0f); + final StorableField f = createField(sf, ref.toString(), 1.0f); return toObject(f); } @@ -356,12 +356,12 @@ } /** Given the stored field, return the human readable representation */ - public String storedToReadable(IndexableField f) { + public String storedToReadable(StorableField f) { return toExternal(f); } /** Given the stored field, return the indexed form */ - public String storedToIndexed(GeneralField f) { + public String storedToIndexed(StorableField f) { // right now, the transformation of single valued fields like SortableInt // is done when the Field is created, not at analysis time... this means // that the indexed form is the same as the stored field form. @@ -530,7 +530,7 @@ /** * calls back to TextResponseWriter to write the field value */ - public abstract void write(TextResponseWriter writer, String name, GeneralField f) throws IOException; + public abstract void write(TextResponseWriter writer, String name, StorableField f) throws IOException; /** Index: solr/core/src/java/org/apache/solr/schema/FloatField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/FloatField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/FloatField.java (working copy) @@ -23,6 +23,7 @@ import org.apache.solr.search.QParser; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.solr.response.TextResponseWriter; import java.util.Map; @@ -61,7 +62,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { String s = f.stringValue(); // these values may be from a legacy lucene index, which may @@ -86,7 +87,7 @@ } @Override - public Float toObject(GeneralField f) { + public Float toObject(StorableField f) { return Float.valueOf( toExternal(f) ); } } Index: solr/core/src/java/org/apache/solr/schema/GeoHashField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/GeoHashField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/GeoHashField.java (working copy) @@ -21,6 +21,7 @@ import org.apache.lucene.queries.function.valuesource.LiteralValueSource; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.Query; import org.apache.lucene.search.SortField; import com.spatial4j.core.context.ParseUtils; @@ -74,14 +75,14 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeStr(name, toExternal(f), false); } @Override - public String toExternal(GeneralField f) { + public String toExternal(StorableField f) { Point p = GeohashUtils.decode(f.stringValue(),ctx); return p.getY() + "," + p.getX(); } Index: solr/core/src/java/org/apache/solr/schema/IndexSchema.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/IndexSchema.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/IndexSchema.java (working copy) @@ -21,10 +21,10 @@ import org.apache.lucene.analysis.AnalyzerWrapper; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.search.similarities.Similarity; import org.apache.lucene.util.Version; import org.apache.lucene.analysis.util.ResourceLoader; -import org.apache.lucene.document.StoredDocument; import org.apache.solr.common.SolrException; import org.apache.solr.common.params.SolrParams; import org.apache.solr.util.DOMUtil; Index: solr/core/src/java/org/apache/solr/schema/IntField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/IntField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/IntField.java (working copy) @@ -23,6 +23,7 @@ import org.apache.solr.search.QParser; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.solr.response.TextResponseWriter; import java.util.Map; @@ -61,7 +62,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { String s = f.stringValue(); // these values may be from a legacy lucene index, which may @@ -86,7 +87,7 @@ } @Override - public Integer toObject(GeneralField f) { + public Integer toObject(StorableField f) { return Integer.valueOf( toExternal(f) ); } } Index: solr/core/src/java/org/apache/solr/schema/LatLonType.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/LatLonType.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/LatLonType.java (working copy) @@ -21,6 +21,7 @@ import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.AtomicReaderContext; +import org.apache.lucene.index.StorableField; import org.apache.lucene.queries.function.FunctionValues; import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.queries.function.valuesource.VectorValueSource; @@ -61,10 +62,10 @@ } @Override - public IndexableField[] createFields(SchemaField field, Object value, float boost) { + public StorableField[] createFields(SchemaField field, Object value, float boost) { String externalVal = value.toString(); //we could have tileDiff + 3 fields (two for the lat/lon, one for storage) - IndexableField[] f = new IndexableField[(field.indexed() ? 2 : 0) + (field.stored() ? 1 : 0)]; + StorableField[] f = new StorableField[(field.indexed() ? 2 : 0) + (field.stored() ? 1 : 0)]; if (field.indexed()) { int i = 0; double[] latLon; @@ -245,7 +246,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { writer.writeStr(name, f.stringValue(), false); } @@ -259,7 +260,7 @@ //It never makes sense to create a single field, so make it impossible to happen @Override - public IndexableField createField(SchemaField field, Object value, float boost) { + public StorableField createField(SchemaField field, Object value, float boost) { throw new UnsupportedOperationException("LatLonType uses multiple fields. field=" + field.getName()); } Index: solr/core/src/java/org/apache/solr/schema/LongField.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/LongField.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/LongField.java (working copy) @@ -21,6 +21,7 @@ import org.apache.lucene.queries.function.valuesource.LongFieldSource; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.SortField; import org.apache.solr.response.TextResponseWriter; import org.apache.solr.search.QParser; @@ -63,7 +64,7 @@ } @Override - public void write(TextResponseWriter writer, String name, GeneralField f) throws IOException { + public void write(TextResponseWriter writer, String name, StorableField f) throws IOException { String s = f.stringValue(); // these values may be from a legacy lucene index, which may @@ -88,7 +89,7 @@ } @Override - public Long toObject(GeneralField f) { + public Long toObject(StorableField f) { return Long.valueOf( toExternal(f) ); } } Index: solr/core/src/java/org/apache/solr/schema/PointType.java =================================================================== --- solr/core/src/java/org/apache/solr/schema/PointType.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/schema/PointType.java (working copy) @@ -22,6 +22,7 @@ import org.apache.lucene.queries.function.valuesource.VectorValueSource; import org.apache.lucene.index.GeneralField; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; @@ -70,7 +71,7 @@ } @Override - public IndexableField[] createFields(SchemaField field, Object value, float boost) { + public StorableField[] createFields(SchemaField field, Object value, float boost) { String externalVal = value.toString(); String[] point = new String[0]; try { @@ -80,7 +81,7 @@ } // TODO: this doesn't currently support polyFields as sub-field types - IndexableField[] f = new IndexableField[ (field.indexed() ? dimension : 0) + (field.stored() ? 1 : 0) ]; + StorableField[] f = new StorableField[ (field.indexed() ? dimension : 0) + (field.stored() ? 1 : 0) ]; if (field.indexed()) { for (int i=0; i 0) { if (!sfield.multiValued()) { String oldValue = map.put(sfield.getName(), val); @@ -66,12 +69,12 @@ } } // Add each field - for (IndexableField field : fields) { - doc.add(field); + for (StorableField field : fields) { + doc.add((Field) field); } } } else { - IndexableField field = sfield.createField(val, boost); + StorableField field = sfield.createField(val, boost); if (field != null) { if (!sfield.multiValued()) { String oldValue = map.put(sfield.getName(), val); @@ -81,7 +84,7 @@ } } } - doc.add(field); + doc.add((Field) field); } } @@ -190,13 +193,13 @@ private static void addField(Document doc, SchemaField field, Object val, float boost) { if (field.isPolyField()) { - IndexableField[] farr = field.getType().createFields(field, val, boost); - for (IndexableField f : farr) { - if (f != null) doc.add(f); // null fields are not added + StorableField[] farr = field.getType().createFields(field, val, boost); + for (StorableField f : farr) { + if (f != null) doc.add((Field) f); // null fields are not added } } else { - IndexableField f = field.createField(val, boost); - if (f != null) doc.add(f); // null fields are not added + StorableField f = field.createField(val, boost); + if (f != null) doc.add((Field) f); // null fields are not added } } Index: solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java =================================================================== --- solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java (revision 1371227) +++ solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java (working copy) @@ -18,9 +18,9 @@ package org.apache.solr.util; import org.apache.lucene.document.Document; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.queryparser.classic.ParseException; import org.apache.lucene.queryparser.classic.QueryParser; import org.apache.lucene.search.*; Index: solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java =================================================================== --- solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java (revision 1371227) +++ solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java (working copy) @@ -30,10 +30,11 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.LogMergePolicy; +import org.apache.lucene.index.StorableField; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.util.English; import org.apache.solr.common.SolrException; import org.apache.solr.common.params.CommonParams; @@ -420,7 +421,7 @@ IndexSchema ischema = new IndexSchema(solrConfig, getSchemaFile(), null); SchemaField f; // Solr field type - IndexableField luf; // Lucene field + StorableField luf; // Lucene field f = ischema.getField("test_basictv"); luf = f.createField("test", 0f); Index: solr/core/src/test/org/apache/solr/schema/CurrencyFieldTest.java =================================================================== --- solr/core/src/test/org/apache/solr/schema/CurrencyFieldTest.java (revision 1371227) +++ solr/core/src/test/org/apache/solr/schema/CurrencyFieldTest.java (working copy) @@ -17,6 +17,7 @@ */ import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.core.SolrCore; import org.junit.BeforeClass; @@ -71,7 +72,7 @@ FieldType tmp = amount.getType(); assertTrue(tmp instanceof CurrencyField); String currencyValue = "1.50,EUR"; - IndexableField[] fields = amount.createFields(currencyValue, 2); + StorableField[] fields = amount.createFields(currencyValue, 2); assertEquals(fields.length, 3); // First field is currency code, second is value, third is stored. Index: solr/core/src/test/org/apache/solr/schema/DateFieldTest.java =================================================================== --- solr/core/src/test/org/apache/solr/schema/DateFieldTest.java (revision 1371227) +++ solr/core/src/test/org/apache/solr/schema/DateFieldTest.java (working copy) @@ -19,6 +19,7 @@ import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.util.LuceneTestCase; import org.apache.solr.util.DateMathParser; @@ -207,7 +208,7 @@ public void testCreateField() { int props = FieldProperties.INDEXED ^ FieldProperties.STORED; SchemaField sf = new SchemaField( "test", f, props, null ); - IndexableField out = f.createField(sf, "1995-12-31T23:59:59Z", 1.0f ); + StorableField out = f.createField(sf, "1995-12-31T23:59:59Z", 1.0f ); assertEquals(820454399000l, f.toObject( out ).getTime() ); out = f.createField(sf, new Date(820454399000l), 1.0f ); Index: solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java =================================================================== --- solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java (revision 1371227) +++ solr/core/src/test/org/apache/solr/schema/PolyFieldTest.java (working copy) @@ -18,6 +18,7 @@ import org.apache.lucene.queries.function.ValueSource; import org.apache.lucene.index.IndexableField; +import org.apache.lucene.index.StorableField; import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Query; @@ -83,7 +84,7 @@ assertEquals(pt.getDimension(), 2); double[] xy = new double[]{35.0, -79.34}; String point = xy[0] + "," + xy[1]; - IndexableField[] fields = home.createFields(point, 2); + StorableField[] fields = home.createFields(point, 2); assertEquals(fields.length, 3);//should be 3, we have a stored field //first two fields contain the values, third is just stored and contains the original for (int i = 0; i < 3; i++) { Index: solr/core/src/test/org/apache/solr/search/TestStressLucene.java =================================================================== --- solr/core/src/test/org/apache/solr/search/TestStressLucene.java (revision 1371227) +++ solr/core/src/test/org/apache/solr/search/TestStressLucene.java (working copy) @@ -21,11 +21,11 @@ import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; -import org.apache.lucene.document.StoredDocument; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.RandomIndexWriter; +import org.apache.lucene.index.StoredDocument; import org.apache.lucene.index.Term; import org.apache.lucene.search.TermQuery; import org.apache.lucene.store.Directory;