diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 55192fa9c7a..6a37b135976 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -166,6 +166,11 @@ Changes in backwards compatibility policy arbitrary relationships. To navigate to a scorer's children, call Scorer.getChildren(). (Robert Muir) +* LUCENE-2308: Field is now instantiated with an instance of IndexableFieldType, of which there + is a core implementation FieldType. Most properties describing a Field have been moved to + IndexableFieldType. See MIGRATE.txt for more details. + (Nikola Tankovic, Mike McCandless, Chris Male) + Changes in Runtime Behavior * LUCENE-2846: omitNorms now behaves like omitTermFrequencyAndPositions, if you diff --git a/lucene/MIGRATE.txt b/lucene/MIGRATE.txt index 9c2f5d952f9..8cf47a8e6f8 100644 --- a/lucene/MIGRATE.txt +++ b/lucene/MIGRATE.txt @@ -410,14 +410,14 @@ LUCENE-1458, LUCENE-2111: Flexible Indexing -* LUCENE-2308: Separate FieldType from Field instances +* LUCENE-2308: Separate IndexableFieldType from Field instances With this change, the indexing details (indexed, tokenized, norms, indexOptions, stored, etc.) are moved into a separate FieldType instance (rather than being stored directly on the Field). -This means you can create the FieldType instance once, up front, for a -given field, and then re-use that instance whenever you instantiate +This means you can create the IndexableFieldType instance once, up front, +for a given field, and then re-use that instance whenever you instantiate the Field. Certain field types are pre-defined since they are common cases: @@ -454,9 +454,7 @@ You can of course also create your own FieldType from scratch: t.setOmitNorms(true); t.setIndexOptions(IndexOptions.DOCS_AND_FREQS); -FieldType has a freeze() method to prevent further changes. Note that -once a FieldType is bound to a Field, it's frozen, to help prevent -confusing bugs. +FieldType has a freeze() method to prevent further changes. When migrating from the 3.x API, if you did this before: diff --git a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java index 0e76d0deef9..35ef911c679 100644 --- a/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java +++ b/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java @@ -26,9 +26,9 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; +import org.apache.lucene.document.FieldType; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.document.FieldType; import org.apache.lucene.document.TextField; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexReader; diff --git a/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java b/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java index 21194e2b93e..9eb82eb2797 100644 --- a/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java +++ b/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java @@ -199,7 +199,7 @@ public class InstantiatedIndex documentsByNumber[i] = document; for (IndexableField field : document.getDocument()) { if (fields == null || fields.contains(field.name())) { - if (field.storeTermVectors()) { + if (field.fieldType().storeTermVectors()) { if (document.getVectorSpace() == null) { document.setVectorSpace(new HashMap>()); } @@ -291,7 +291,7 @@ public class InstantiatedIndex continue; // deleted } for (IndexableField field : document.getDocument()) { - if (field.storeTermVectors() && field.storeTermVectorOffsets()) { + if (field.fieldType().storeTermVectors() && field.fieldType().storeTermVectorOffsets()) { TermPositionVector termPositionVector = (TermPositionVector) sourceIndexReader.getTermFreqVector(document.getDocumentNumber(), field.name()); if (termPositionVector != null) { for (int i = 0; i < termPositionVector.getTerms().length; i++) { diff --git a/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java b/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java index 9af81086ad1..01512b149a4 100644 --- a/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java +++ b/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java @@ -484,28 +484,28 @@ public class InstantiatedIndexWriter implements Closeable { // once fieldSettings, always fieldSettings. - if (field.omitNorms()) { + if (field.fieldType().omitNorms()) { fieldSetting.omitNorms = true; } - if (field.indexed() ) { + if (field.fieldType().indexed() ) { fieldSetting.indexed = true; } - if (field.tokenized()) { + if (field.fieldType().tokenized()) { fieldSetting.tokenized = true; } - if (field.stored()) { + if (field.fieldType().stored()) { fieldSetting.stored = true; } if (field.binaryValue() != null) { fieldSetting.isBinary = true; } - if (field.storeTermVectors()) { + if (field.fieldType().storeTermVectors()) { fieldSetting.storeTermVector = true; } - if (field.storeTermVectorPositions()) { + if (field.fieldType().storeTermVectorPositions()) { fieldSetting.storePositionWithTermVector = true; } - if (field.storeTermVectorOffsets()) { + if (field.fieldType().storeTermVectorOffsets()) { fieldSetting.storeOffsetWithTermVector = true; } } @@ -519,12 +519,12 @@ public class InstantiatedIndexWriter implements Closeable { FieldSetting fieldSetting = fieldSettingsByFieldName.get(field.name()); - if (field.indexed()) { + if (field.fieldType().indexed()) { LinkedList tokens = new LinkedList(); tokensByField.put(field, tokens); - if (field.tokenized()) { + if (field.fieldType().tokenized()) { final TokenStream tokenStream; // todo readerValue(), binaryValue() if (field.tokenStreamValue() != null) { @@ -564,7 +564,7 @@ public class InstantiatedIndexWriter implements Closeable { } } - if (!field.stored()) { + if (!field.fieldType().stored()) { //it.remove(); } } @@ -610,7 +610,7 @@ public class InstantiatedIndexWriter implements Closeable { termDocumentInformationFactory.payloads.add(null); } - if (eField_Tokens.getKey().storeTermVectorOffsets()) { + if (eField_Tokens.getKey().fieldType().storeTermVectorOffsets()) { termDocumentInformationFactory.termOffsets.add(new TermVectorOffsetInfo(fieldSetting.offset + token.startOffset(), fieldSetting.offset + token.endOffset())); lastOffset = fieldSetting.offset + token.endOffset(); @@ -619,7 +619,7 @@ public class InstantiatedIndexWriter implements Closeable { } - if (eField_Tokens.getKey().storeTermVectorOffsets()) { + if (eField_Tokens.getKey().fieldType().storeTermVectorOffsets()) { fieldSetting.offset = lastOffset + 1; } diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestNRTManager.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestNRTManager.java index d2301717f1e..5a7c73ff0a7 100644 --- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestNRTManager.java +++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestNRTManager.java @@ -82,7 +82,7 @@ public class TestNRTManager extends LuceneTestCase { Field field1 = (Field) f; Field field2 = new Field(field1.name(), - ((Field) f).getFieldType(), + ((Field) f).fieldType(), field1.stringValue()); doc2.add(field2); } diff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java index 120c8477aa1..e1a0a8dbb65 100644 --- a/lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java +++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/TestTermVectorAccessor.java @@ -28,9 +28,7 @@ public class TestTermVectorAccessor extends LuceneTestCase { Directory dir = newDirectory(); IndexWriter iw = new IndexWriter(dir, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random))); - Document doc; - - doc = new Document(); + Document doc = new Document(); FieldType customType = new FieldType(TextField.TYPE_UNSTORED); customType.setStoreTermVectors(true); customType.setStoreTermVectorPositions(true); diff --git a/lucene/src/java/org/apache/lucene/analysis/Analyzer.java b/lucene/src/java/org/apache/lucene/analysis/Analyzer.java index 43cf759cadf..c9cee21f3a5 100644 --- a/lucene/src/java/org/apache/lucene/analysis/Analyzer.java +++ b/lucene/src/java/org/apache/lucene/analysis/Analyzer.java @@ -138,7 +138,7 @@ public abstract class Analyzer implements Closeable { * @return offset gap, added to the next token emitted from {@link #tokenStream(String,Reader)} */ public int getOffsetGap(IndexableField field) { - if (field.tokenized()) { + if (field.fieldType().tokenized()) { return 1; } else { return 0; diff --git a/lucene/src/java/org/apache/lucene/document/Document.java b/lucene/src/java/org/apache/lucene/document/Document.java index fc806aa3765..325e2dfffcc 100644 --- a/lucene/src/java/org/apache/lucene/document/Document.java +++ b/lucene/src/java/org/apache/lucene/document/Document.java @@ -28,12 +28,12 @@ import org.apache.lucene.util.BytesRef; /** Documents are the unit of indexing and search. * * A Document is a set of fields. Each field has a name and a textual value. - * A field may be {@link IndexableField#stored() stored} with the document, in which + * A field may be {@link org.apache.lucene.index.IndexableFieldType#stored() stored} with the document, in which * case it is returned with search hits on the document. Thus each document * should typically contain one or more stored fields which uniquely identify * it. * - *

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

Note that fields which are not {@link org.apache.lucene.index.IndexableFieldType#stored() stored} are * not available in documents retrieved from the index, e.g. with {@link * ScoreDoc#doc} or {@link IndexReader#document(int)}. */ diff --git a/lucene/src/java/org/apache/lucene/document/Field.java b/lucene/src/java/org/apache/lucene/document/Field.java index 8f8d2f1fd96..f82c9adc3c7 100644 --- a/lucene/src/java/org/apache/lucene/document/Field.java +++ b/lucene/src/java/org/apache/lucene/document/Field.java @@ -20,7 +20,7 @@ package org.apache.lucene.document; import java.io.Reader; import org.apache.lucene.analysis.TokenStream; -import org.apache.lucene.index.FieldInfo.IndexOptions; +import org.apache.lucene.index.IndexableFieldType; import org.apache.lucene.index.IndexableField; import org.apache.lucene.index.values.PerDocFieldValues; import org.apache.lucene.index.values.ValueType; @@ -32,11 +32,14 @@ import org.apache.lucene.util.BytesRef; * may be atomic keywords, which are not further processed. Such keywords may be * used to represent dates, urls, etc. Fields are optionally stored in the * index, so that they may be returned with hits on the document. + *

+ * Note, Field instances are instantiated with a {@link IndexableFieldType}. Making changes + * to the state of the FieldType will impact any Field it is used in, therefore + * it is strongly recommended that no changes are made after Field instantiation. */ - public class Field implements IndexableField { - protected FieldType type; + protected IndexableFieldType type; protected String name = "body"; // the data object for all different kind of field values protected Object fieldsData; @@ -47,13 +50,12 @@ public class Field implements IndexableField { protected float boost = 1.0f; - public Field(String name, FieldType type) { + public Field(String name, IndexableFieldType type) { this.name = name; this.type = type; - type.freeze(); } - public Field(String name, FieldType type, Reader reader) { + public Field(String name, IndexableFieldType type, Reader reader) { if (name == null) { throw new NullPointerException("name cannot be null"); } @@ -64,10 +66,9 @@ public class Field implements IndexableField { this.name = name; this.fieldsData = reader; this.type = type; - type.freeze(); } - public Field(String name, FieldType type, TokenStream tokenStream) { + public Field(String name, IndexableFieldType type, TokenStream tokenStream) { if (name == null) { throw new NullPointerException("name cannot be null"); } @@ -79,28 +80,25 @@ public class Field implements IndexableField { this.fieldsData = null; this.tokenStream = tokenStream; this.type = type; - type.freeze(); } - public Field(String name, FieldType type, byte[] value) { + public Field(String name, IndexableFieldType type, byte[] value) { this(name, type, value, 0, value.length); } - public Field(String name, FieldType type, byte[] value, int offset, int length) { + public Field(String name, IndexableFieldType type, byte[] value, int offset, int length) { this.fieldsData = new BytesRef(value, offset, length); this.type = type; this.name = name; - type.freeze(); } - public Field(String name, FieldType type, BytesRef bytes) { + public Field(String name, IndexableFieldType type, BytesRef bytes) { this.fieldsData = bytes; this.type = type; this.name = name; - type.freeze(); } - public Field(String name, FieldType type, String value) { + public Field(String name, IndexableFieldType type, String value) { if (name == null) { throw new IllegalArgumentException("name cannot be null"); } @@ -119,7 +117,6 @@ public class Field implements IndexableField { this.type = type; this.name = name; this.fieldsData = value; - type.freeze(); } /** @@ -181,7 +178,7 @@ public class Field implements IndexableField { throw new IllegalArgumentException( "cannot set a Reader value on a binary field"); } - if (stored()) { + if (type.stored()) { throw new IllegalArgumentException( "cannot set a Reader value on a stored field"); } @@ -206,7 +203,7 @@ public class Field implements IndexableField { * values from stringValue() or getBinaryValue() */ public void setTokenStream(TokenStream tokenStream) { - if (!indexed() || !tokenized()) { + if (!type.indexed() || !type.tokenized()) { throw new IllegalArgumentException( "cannot set token stream on non indexed and tokenized field"); } @@ -259,44 +256,12 @@ public class Field implements IndexableField { } } - /** methods from inner FieldType */ + /** methods from inner IndexableFieldType */ public boolean isBinary() { return fieldsData instanceof BytesRef; } - public boolean stored() { - return type.stored(); - } - - public boolean indexed() { - return type.indexed(); - } - - public boolean tokenized() { - return type.tokenized(); - } - - public boolean omitNorms() { - return type.omitNorms(); - } - - public IndexOptions indexOptions() { - return type.indexOptions(); - } - - public boolean storeTermVectors() { - return type.storeTermVectors(); - } - - public boolean storeTermVectorOffsets() { - return type.storeTermVectorOffsets(); - } - - public boolean storeTermVectorPositions() { - return type.storeTermVectorPositions(); - } - /** Prints a Field for human consumption. */ @Override public String toString() { @@ -329,7 +294,7 @@ public class Field implements IndexableField { } /** Returns FieldType for this field. */ - public FieldType getFieldType() { + public IndexableFieldType fieldType() { return type; } } diff --git a/lucene/src/java/org/apache/lucene/document/FieldType.java b/lucene/src/java/org/apache/lucene/document/FieldType.java index 0b67bbb1e96..a219f82122c 100644 --- a/lucene/src/java/org/apache/lucene/document/FieldType.java +++ b/lucene/src/java/org/apache/lucene/document/FieldType.java @@ -18,8 +18,9 @@ package org.apache.lucene.document; */ import org.apache.lucene.index.FieldInfo.IndexOptions; +import org.apache.lucene.index.IndexableFieldType; -public class FieldType { +public class FieldType implements IndexableFieldType { private boolean indexed; private boolean stored; @@ -31,7 +32,7 @@ public class FieldType { private IndexOptions indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; private boolean frozen; - public FieldType(FieldType ref) { + public FieldType(IndexableFieldType ref) { this.indexed = ref.indexed(); this.stored = ref.stored(); this.tokenized = ref.tokenized(); @@ -52,8 +53,11 @@ public class FieldType { } } - /** Prevents future changes. Note that when a FieldType - * is first bound to a Field instance, it is frozen. */ + /** + * Prevents future changes. Note, it is recommended that this is called once + * the FieldTypes's properties have been set, to prevent unintential state + * changes. + */ public void freeze() { this.frozen = true; } diff --git a/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java b/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java index 53288ca321f..bb61a6207f0 100644 --- a/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java +++ b/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java @@ -20,6 +20,7 @@ import java.io.Reader; import java.util.Comparator; import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.index.IndexableFieldType; import org.apache.lucene.index.values.PerDocFieldValues; import org.apache.lucene.index.values.ValueType; import org.apache.lucene.util.BytesRef; @@ -84,11 +85,11 @@ public class IndexDocValuesField extends Field implements PerDocFieldValues { this(name, new FieldType()); } - public IndexDocValuesField(String name, FieldType type) { + public IndexDocValuesField(String name, IndexableFieldType type) { this(name, type, null); } - public IndexDocValuesField(String name, FieldType type, String value) { + public IndexDocValuesField(String name, IndexableFieldType type, String value) { super(name, type); fieldsData = value; } @@ -356,7 +357,7 @@ public class IndexDocValuesField extends Field implements PerDocFieldValues { if (field instanceof IndexDocValuesField) { return (IndexDocValuesField) field; } - final IndexDocValuesField valField = new IndexDocValuesField(field.name(), field.getFieldType(), field.stringValue()); + final IndexDocValuesField valField = new IndexDocValuesField(field.name(), field.fieldType(), field.stringValue()); switch (type) { case BYTES_FIXED_DEREF: case BYTES_FIXED_SORTED: diff --git a/lucene/src/java/org/apache/lucene/document/NumericField.java b/lucene/src/java/org/apache/lucene/document/NumericField.java index 4b97f40c490..79c844df9ed 100644 --- a/lucene/src/java/org/apache/lucene/document/NumericField.java +++ b/lucene/src/java/org/apache/lucene/document/NumericField.java @@ -104,7 +104,7 @@ import org.apache.lucene.search.FieldCache; // javadocs * default value, 4, was selected for a reasonable tradeoff * of disk space consumption versus performance. You can * use the expert constructor {@link - * #NumericField(String,int,FieldType)} if you'd + * #NumericField(String,int, FieldType)} if you'd * like to change the value. Note that you must also * specify a congruent value when creating {@link * NumericRangeQuery} or {@link NumericRangeFilter}. @@ -238,7 +238,7 @@ public final class NumericField extends Field { /** Returns a {@link NumericTokenStream} for indexing the numeric value. */ public TokenStream tokenStreamValue() { - if (!indexed()) return null; + if (!type.indexed()) return null; if (numericTS == null) { // lazy init the TokenStream as it is heavy to instantiate // (attributes,...), diff --git a/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java b/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java index ec14a922b48..96005a394e6 100644 --- a/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java +++ b/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java @@ -223,9 +223,7 @@ final class DocFieldProcessor extends DocConsumer { // needs to be more "pluggable" such that if I want // to have a new "thing" my Fields can do, I can // easily add it - FieldInfo fi = fieldInfos.addOrUpdate(fieldName, field.indexed(), field.storeTermVectors(), - field.storeTermVectorPositions(), field.storeTermVectorOffsets(), - field.omitNorms(), false, field.indexOptions(), field.docValuesType()); + FieldInfo fi = fieldInfos.addOrUpdate(fieldName, field.fieldType(), false, field.docValuesType()); fp = new DocFieldProcessorPerField(this, fi); fp.next = fieldHash[hashPos]; @@ -236,9 +234,7 @@ final class DocFieldProcessor extends DocConsumer { rehash(); } } else { - fieldInfos.addOrUpdate(fp.fieldInfo.name, field.indexed(), field.storeTermVectors(), - field.storeTermVectorPositions(), field.storeTermVectorOffsets(), - field.omitNorms(), false, field.indexOptions(), field.docValuesType()); + fieldInfos.addOrUpdate(fp.fieldInfo.name, field.fieldType(), false, field.docValuesType()); } if (thisFieldGen != fp.lastGen) { @@ -259,7 +255,7 @@ final class DocFieldProcessor extends DocConsumer { fp.addField(field); - if (field.stored()) { + if (field.fieldType().stored()) { fieldsWriter.addField(field, fp.fieldInfo); } final PerDocFieldValues docValues = field.docValues(); diff --git a/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java b/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java index f4a97e25935..7ebfff750bd 100644 --- a/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java +++ b/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java @@ -74,7 +74,7 @@ final class DocInverterPerField extends DocFieldConsumerPerField { // TODO FI: this should be "genericized" to querying // consumer if it wants to see this particular field // tokenized. - if (field.indexed() && doInvert) { + if (field.fieldType().indexed() && doInvert) { if (i > 0) fieldState.position += docState.analyzer == null ? 0 : docState.analyzer.getPositionIncrementGap(fieldInfo.name); @@ -83,7 +83,7 @@ final class DocInverterPerField extends DocFieldConsumerPerField { // outside of indexer -- field should simply give us // a TokenStream, even for multi-valued fields - if (!field.tokenized()) { // un-tokenized field + if (!field.fieldType().tokenized()) { // un-tokenized field final String stringValue = field.stringValue(); assert stringValue != null; final int valueLength = stringValue.length(); diff --git a/lucene/src/java/org/apache/lucene/index/FieldInfos.java b/lucene/src/java/org/apache/lucene/index/FieldInfos.java index cfb73b820a4..6108aebba8e 100644 --- a/lucene/src/java/org/apache/lucene/index/FieldInfos.java +++ b/lucene/src/java/org/apache/lucene/index/FieldInfos.java @@ -456,6 +456,12 @@ public final class FieldInfos implements Iterable { storeOffsetWithTermVector, omitNorms, storePayloads, indexOptions, docValues); } + synchronized public FieldInfo addOrUpdate(String name, IndexableFieldType fieldType, boolean scorePayloads, ValueType docValues) { + return addOrUpdateInternal(name, -1, fieldType.indexed(), fieldType.storeTermVectors(), + fieldType.storeTermVectorPositions(), fieldType.storeTermVectorOffsets(), fieldType.omitNorms(), scorePayloads, + fieldType.indexOptions(), docValues); + } + synchronized private FieldInfo addOrUpdateInternal(String name, int preferredFieldNumber, boolean isIndexed, boolean storeTermVector, boolean storePositionWithTermVector, boolean storeOffsetWithTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, ValueType docValues) { diff --git a/lucene/src/java/org/apache/lucene/index/FieldsWriter.java b/lucene/src/java/org/apache/lucene/index/FieldsWriter.java index a59197f4ee8..5bc4fe55504 100644 --- a/lucene/src/java/org/apache/lucene/index/FieldsWriter.java +++ b/lucene/src/java/org/apache/lucene/index/FieldsWriter.java @@ -217,14 +217,14 @@ final class FieldsWriter { int storedCount = 0; for (IndexableField field : doc) { - if (field.stored()) { + if (field.fieldType().stored()) { storedCount++; } } fieldsStream.writeVInt(storedCount); for (IndexableField field : doc) { - if (field.stored()) { + if (field.fieldType().stored()) { writeField(fieldInfos.fieldNumber(field.name()), field); } } diff --git a/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java b/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java index aa4f49f953e..842f3c407dc 100644 --- a/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java +++ b/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java @@ -83,7 +83,7 @@ final class FreqProxTermsWriterPerField extends TermsHashConsumerPerField implem @Override boolean start(IndexableField[] fields, int count) { for(int i=0;i