Apache Solr open-source search software
LUCENE-6039: cutover to IndexOptions.NO/DocValuesType.NO instead of null
Michael McCandlessbc41d58cd37a
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 729285c1a84..07339ebe443 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -194,6 +194,13 @@ Bug Fixesbehave properly when wrapping other ValueSources which do not exist for the specified document(hossman)+* LUCENE-6039: Add IndexOptions.NO and DocValuesType.NO instead of+ using null to mean not index and no doc values, renamed+ IndexOptions.DOCS_ONLY to DOCS, and pulled IndexOptions and+ DocValues out of FieldInfo into their own classes in+ org.apache.lucene.index (Simon Willnauer, Robert Muir, Mike+ McCandless)+Documentation* LUCENE-5392: Add/improve analysis package documentation to reflectdiff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.javaindex 21167ba3753..0608e8348a4 100644--- a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java+++ b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java@@ -51,7 +51,6 @@ import org.apache.lucene.document.SortedNumericDocValuesField;import org.apache.lucene.document.SortedSetDocValuesField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.IndexSearcher;@@ -920,12 +919,12 @@ public class TestBackwardsCompatibility extends LuceneTestCase {private void addNoProxDoc(IndexWriter writer) throws IOException {Document doc = new Document();FieldType customType = new FieldType(TextField.TYPE_STORED);- customType.setIndexOptions(IndexOptions.DOCS_ONLY);+ customType.setIndexOptions(IndexOptions.DOCS);Field f = new Field("content3", "aaa", customType);doc.add(f);FieldType customType2 = new FieldType();customType2.setStored(true);- customType2.setIndexOptions(IndexOptions.DOCS_ONLY);+ customType2.setIndexOptions(IndexOptions.DOCS);f = new Field("content4", "aaa", customType2);doc.add(f);writer.addDocument(doc);diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.javaindex 36d73ca6751..a04c1390e9b 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsReader.java@@ -31,9 +31,9 @@ import org.apache.lucene.codecs.PostingsReaderBase;import org.apache.lucene.index.CorruptIndexException;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.TermState;import org.apache.lucene.index.Terms;@@ -140,7 +140,7 @@ public class BlockTermsReader extends FieldsProducer {assert numTerms >= 0;final long termsStartPointer = in.readVLong();final FieldInfo fieldInfo = state.fieldInfos.fieldInfo(field);- final long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY ? -1 : in.readVLong();+ final long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS ? -1 : in.readVLong();final long sumDocFreq = in.readVLong();final int docCount = in.readVInt();final int longsSize = in.readVInt();@@ -827,7 +827,7 @@ public class BlockTermsReader extends FieldsProducer {// docFreq, totalTermFreqstate.docFreq = freqReader.readVInt();//System.out.println(" dF=" + state.docFreq);- if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) {state.totalTermFreq = state.docFreq + freqReader.readVLong();//System.out.println(" totTF=" + state.totalTermFreq);}diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.javaindex 9d143c11848..94033ea5d31 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java@@ -28,7 +28,7 @@ import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.FieldsConsumer;import org.apache.lucene.codecs.PostingsWriterBase;import org.apache.lucene.codecs.TermStats;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;@@ -172,7 +172,7 @@ public class BlockTermsWriter extends FieldsConsumer implements Closeable {out.writeVInt(field.fieldInfo.number);out.writeVLong(field.numTerms);out.writeVLong(field.termsStartPointer);- if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {out.writeVLong(field.sumTotalTermFreq);}out.writeVLong(field.sumDocFreq);@@ -347,7 +347,7 @@ public class BlockTermsWriter extends FieldsConsumer implements Closeable {final BlockTermState state = pendingTerms[termCount].state;assert state != null;bytesWriter.writeVInt(state.docFreq);- if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) {bytesWriter.writeVLong(state.totalTermFreq-state.docFreq);}}diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsReader.javaindex b34899bfa86..86a539653e6 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsReader.java@@ -29,7 +29,7 @@ import org.apache.lucene.codecs.FieldsProducer;import org.apache.lucene.codecs.PostingsReaderBase;import org.apache.lucene.codecs.blocktreeords.FSTOrdsOutputs.Output;import org.apache.lucene.index.CorruptIndexException;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.IndexFileNames;import org.apache.lucene.index.SegmentReadState;@@ -125,7 +125,7 @@ public final class OrdsBlockTreeTermsReader extends FieldsProducer {final FieldInfo fieldInfo = state.fieldInfos.fieldInfo(field);assert fieldInfo != null: "field=" + field;assert numTerms <= Integer.MAX_VALUE;- final long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY ? -1 : in.readVLong();+ final long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS ? -1 : in.readVLong();final long sumDocFreq = in.readVLong();final int docCount = in.readVInt();final int longsSize = in.readVInt();diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsWriter.javaindex a3104220745..649a1e57e2e 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsBlockTreeTermsWriter.java@@ -27,11 +27,11 @@ import org.apache.lucene.codecs.FieldsConsumer;import org.apache.lucene.codecs.PostingsWriterBase;import org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter; // javadocsimport org.apache.lucene.codecs.blocktreeords.FSTOrdsOutputs.Output;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;@@ -646,7 +646,7 @@ public final class OrdsBlockTreeTermsWriter extends FieldsConsumer {// Write term stats, to separate byte[] blob:statsWriter.writeVInt(state.docFreq);- if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) {assert state.totalTermFreq >= state.docFreq: state.totalTermFreq + " vs " + state.docFreq;statsWriter.writeVLong(state.totalTermFreq - state.docFreq);}@@ -691,7 +691,7 @@ public final class OrdsBlockTreeTermsWriter extends FieldsConsumer {// Write term stats, to separate byte[] blob:statsWriter.writeVInt(state.docFreq);- if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) {assert state.totalTermFreq >= state.docFreq;statsWriter.writeVLong(state.totalTermFreq - state.docFreq);}@@ -802,7 +802,7 @@ public final class OrdsBlockTreeTermsWriter extends FieldsConsumer {BlockTermState state = postingsWriter.writeTerm(text, termsEnum, docsSeen);if (state != null) {assert state.docFreq != 0;- assert fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;+ assert fieldInfo.getIndexOptions() == IndexOptions.DOCS || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;sumDocFreq += state.docFreq;sumTotalTermFreq += state.totalTermFreq;pushTerm(text);@@ -927,7 +927,7 @@ public final class OrdsBlockTreeTermsWriter extends FieldsConsumer {out.writeVLong(field.numTerms);out.writeVInt(field.rootCode.bytes.length);out.writeBytes(field.rootCode.bytes.bytes, field.rootCode.bytes.offset, field.rootCode.bytes.length);- if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {out.writeVLong(field.sumTotalTermFreq);}out.writeVLong(field.sumDocFreq);diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsFieldReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsFieldReader.javaindex 9127ecf5fc1..591e91aa699 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsFieldReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsFieldReader.java@@ -21,8 +21,8 @@ import java.io.IOException;import java.util.Collections;import org.apache.lucene.codecs.blocktreeords.FSTOrdsOutputs.Output;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.ByteArrayDataInput;diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnum.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnum.javaindex 24d01ec3a0f..0eb970908ec 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnum.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnum.java@@ -22,7 +22,7 @@ import java.io.IOException;import org.apache.lucene.codecs.blocktreeords.FSTOrdsOutputs.Output;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermState;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.IndexInput;diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnumFrame.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnumFrame.javaindex 187e76068fe..c74691c21e5 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnumFrame.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsIntersectTermsEnumFrame.java@@ -21,7 +21,7 @@ import java.io.IOException;import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.codecs.blocktreeords.FSTOrdsOutputs.Output;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.store.ByteArrayDataInput;import org.apache.lucene.util.ArrayUtil;import org.apache.lucene.util.BytesRef;@@ -292,7 +292,7 @@ final class OrdsIntersectTermsEnumFrame {// statstermState.docFreq = statsReader.readVInt();//if (DEBUG) System.out.println(" dF=" + state.docFreq);- if (ite.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (ite.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {termState.totalTermFreq = termState.docFreq + statsReader.readVLong();//if (DEBUG) System.out.println(" totTF=" + state.totalTermFreq);}diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.javaindex 75064c21ae4..8bdd248bca1 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.java@@ -27,7 +27,7 @@ import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.codecs.blocktreeords.FSTOrdsOutputs.Output;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermState;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.ByteArrayDataInput;diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnumFrame.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnumFrame.javaindex db6c099124c..bef57cc871a 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnumFrame.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnumFrame.java@@ -21,7 +21,7 @@ import java.io.IOException;import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.codecs.blocktreeords.FSTOrdsOutputs.Output;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermsEnum.SeekStatus;import org.apache.lucene.store.ByteArrayDataInput;import org.apache.lucene.util.ArrayUtil;@@ -499,7 +499,7 @@ final class OrdsSegmentTermsEnumFrame {// statsstate.docFreq = statsReader.readVInt();//if (DEBUG) System.out.println(" dF=" + state.docFreq);- if (ste.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (ste.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {state.totalTermFreq = state.docFreq + statsReader.readVLong();//if (DEBUG) System.out.println(" totTF=" + state.totalTermFreq);}diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.javaindex d2a7624ce11..908abe2a09a 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java@@ -29,9 +29,9 @@ import org.apache.lucene.codecs.PostingsFormat;import org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat; // javadocsimport org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.Fields;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.OrdTermState;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.SegmentWriteState;@@ -327,7 +327,7 @@ public final class DirectPostingsFormat extends PostingsFormat {this.minSkipCount = minSkipCount;- hasFreq = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_ONLY) > 0;+ hasFreq = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS) > 0;hasPos = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) > 0;hasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) > 0;hasPayloads = fieldInfo.hasPayloads();diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsReader.javaindex 65352e7e6f4..62c31c209fe 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsReader.java@@ -29,7 +29,7 @@ import java.util.TreeMap;import org.apache.lucene.index.CorruptIndexException;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.IndexFileNames;@@ -110,7 +110,7 @@ public class FSTOrdTermsReader extends FieldsProducer {final int numFields = blockIn.readVInt();for (int i = 0; i < numFields; i++) {FieldInfo fieldInfo = fieldInfos.fieldInfo(blockIn.readVInt());- boolean hasFreq = fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY;+ boolean hasFreq = fieldInfo.getIndexOptions() != IndexOptions.DOCS;long numTerms = blockIn.readVLong();long sumTotalTermFreq = hasFreq ? blockIn.readVLong() : -1;long sumDocFreq = blockIn.readVLong();diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsWriter.javaindex 5549417d72b..20d8306e3c4 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTOrdTermsWriter.java@@ -25,11 +25,11 @@ import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.FieldsConsumer;import org.apache.lucene.codecs.PostingsWriterBase;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;@@ -231,7 +231,7 @@ public class FSTOrdTermsWriter extends FieldsConsumer {for (FieldMetaData field : fields) {blockOut.writeVInt(field.fieldInfo.number);blockOut.writeVLong(field.numTerms);- if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {blockOut.writeVLong(field.sumTotalTermFreq);}blockOut.writeVLong(field.sumDocFreq);@@ -335,7 +335,7 @@ public class FSTOrdTermsWriter extends FieldsConsumer {if (delta == 0) {statsOut.writeVInt(state.docFreq<<1|1);} else {- statsOut.writeVInt(state.docFreq<<1|0);+ statsOut.writeVInt(state.docFreq<<1);statsOut.writeVLong(state.totalTermFreq-state.docFreq);}} else {diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermOutputs.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermOutputs.javaindex d3bb26fbed3..1862ca87670 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermOutputs.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermOutputs.java@@ -22,7 +22,7 @@ import java.util.Arrays;import java.util.Collections;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.store.DataInput;import org.apache.lucene.store.DataOutput;import org.apache.lucene.util.Accountable;@@ -129,7 +129,7 @@ class FSTTermOutputs extends Outputs<FSTTermOutputs.TermData> {}protected FSTTermOutputs(FieldInfo fieldInfo, int longsSize) {- this.hasPos = (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY);+ this.hasPos = fieldInfo.getIndexOptions() != IndexOptions.DOCS;this.longsSize = longsSize;}diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsReader.javaindex f96897810f2..3cbd2ec6c66 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsReader.java@@ -28,7 +28,7 @@ import java.util.TreeMap;import org.apache.lucene.index.CorruptIndexException;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.IndexFileNames;@@ -95,7 +95,7 @@ public class FSTTermsReader extends FieldsProducer {int fieldNumber = in.readVInt();FieldInfo fieldInfo = fieldInfos.fieldInfo(fieldNumber);long numTerms = in.readVLong();- long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY ? -1 : in.readVLong();+ long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS ? -1 : in.readVLong();long sumDocFreq = in.readVLong();int docCount = in.readVInt();int longsSize = in.readVInt();diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsWriter.javaindex 836ea70943e..7faeade79b2 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/FSTTermsWriter.java@@ -25,7 +25,7 @@ import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.FieldsConsumer;import org.apache.lucene.codecs.PostingsWriterBase;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;@@ -204,7 +204,7 @@ public class FSTTermsWriter extends FieldsConsumer {for (FieldMetaData field : fields) {out.writeVInt(field.fieldInfo.number);out.writeVLong(field.numTerms);- if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {out.writeVLong(field.sumTotalTermFreq);}out.writeVLong(field.sumDocFreq);diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.javaindex e5c93225787..32f21e20ebc 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/memory/MemoryPostingsFormat.java@@ -33,7 +33,7 @@ import org.apache.lucene.index.CorruptIndexException;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;import org.apache.lucene.index.IndexFileNames;@@ -145,7 +145,7 @@ public final class MemoryPostingsFormat extends PostingsFormat {lastDocID = docID;docCount++;- if (field.getIndexOptions() == IndexOptions.DOCS_ONLY) {+ if (field.getIndexOptions() == IndexOptions.DOCS) {buffer.writeVInt(delta);} else if (termDocFreq == 1) {buffer.writeVInt((delta<<1) | 1);@@ -232,7 +232,7 @@ public final class MemoryPostingsFormat extends PostingsFormat {assert buffer2.getFilePointer() == 0;buffer2.writeVInt(stats.docFreq);- if (field.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (field.getIndexOptions() != IndexOptions.DOCS) {buffer2.writeVLong(stats.totalTermFreq-stats.docFreq);}int pos = (int) buffer2.getFilePointer();@@ -262,7 +262,7 @@ public final class MemoryPostingsFormat extends PostingsFormat {if (termCount > 0) {out.writeVInt(termCount);out.writeVInt(field.number);- if (field.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (field.getIndexOptions() != IndexOptions.DOCS) {out.writeVLong(sumTotalTermFreq);}out.writeVLong(sumDocFreq);@@ -470,7 +470,7 @@ public final class MemoryPostingsFormat extends PostingsFormat {return docID = NO_MORE_DOCS;}docUpto++;- if (indexOptions == IndexOptions.DOCS_ONLY) {+ if (indexOptions == IndexOptions.DOCS) {accum += in.readVInt();} else {final int code = in.readVInt();@@ -754,7 +754,7 @@ public final class MemoryPostingsFormat extends PostingsFormat {if (!didDecode) {buffer.reset(current.output.bytes, current.output.offset, current.output.length);docFreq = buffer.readVInt();- if (field.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (field.getIndexOptions() != IndexOptions.DOCS) {totalTermFreq = docFreq + buffer.readVLong();} else {totalTermFreq = -1;@@ -896,7 +896,7 @@ public final class MemoryPostingsFormat extends PostingsFormat {field = fieldInfos.fieldInfo(fieldNumber);if (field == null) {throw new CorruptIndexException("invalid field number: " + fieldNumber, in);- } else if (field.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ } else if (field.getIndexOptions() != IndexOptions.DOCS) {sumTotalTermFreq = in.readVLong();} else {sumTotalTermFreq = -1;diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesReader.javaindex a20e8579bca..107ea505c40 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesReader.java@@ -17,16 +17,6 @@ package org.apache.lucene.codecs.simpletext;* limitations under the License.*/-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.END;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.FIELD;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.LENGTH;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.MAXLENGTH;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.MINVALUE;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.NUMVALUES;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.ORDPATTERN;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.PATTERN;-import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.TYPE;-import java.io.IOException;import java.math.BigDecimal;import java.math.BigInteger;@@ -43,8 +33,8 @@ import org.apache.lucene.codecs.DocValuesProducer;import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.CorruptIndexException;import org.apache.lucene.index.DocValues;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.DocValuesType;import org.apache.lucene.index.IndexFileNames;import org.apache.lucene.index.NumericDocValues;import org.apache.lucene.index.SegmentReadState;@@ -61,6 +51,16 @@ import org.apache.lucene.util.BytesRefBuilder;import org.apache.lucene.util.RamUsageEstimator;import org.apache.lucene.util.StringHelper;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.END;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.FIELD;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.LENGTH;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.MAXLENGTH;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.MINVALUE;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.NUMVALUES;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.ORDPATTERN;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.PATTERN;+import static org.apache.lucene.codecs.simpletext.SimpleTextDocValuesWriter.TYPE;+class SimpleTextDocValuesReader extends DocValuesProducer {private static final long BASE_RAM_BYTES_USED =@@ -104,7 +104,7 @@ class SimpleTextDocValuesReader extends DocValuesProducer {assert startsWith(TYPE) : scratch.get().utf8ToString();DocValuesType dvType = DocValuesType.valueOf(stripPrefix(TYPE));- assert dvType != null;+ assert dvType != DocValuesType.NO;if (dvType == DocValuesType.NUMERIC) {readLine();assert startsWith(MINVALUE): "got " + scratch.get().utf8ToString() + " field=" + fieldName + " ext=" + ext;diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesWriter.javaindex 8642bf8b918..921afa2f81f 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextDocValuesWriter.java@@ -30,7 +30,7 @@ import org.apache.lucene.codecs.DocValuesConsumer;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.IndexFileNames;import org.apache.lucene.index.SegmentWriteState;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.store.IndexOutput;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.BytesRefBuilder;@@ -71,8 +71,8 @@ class SimpleTextDocValuesWriter extends DocValuesConsumer {@Overridepublic void addNumericField(FieldInfo field, Iterable<Number> values) throws IOException {assert fieldSeen(field.name);- assert field.getDocValuesType() == FieldInfo.DocValuesType.NUMERIC || field.hasNorms();- writeFieldEntry(field, FieldInfo.DocValuesType.NUMERIC);+ assert field.getDocValuesType() == DocValuesType.NUMERIC || field.hasNorms();+ writeFieldEntry(field, DocValuesType.NUMERIC);// first pass to find min/maxlong minValue = Long.MAX_VALUE;@@ -145,7 +145,7 @@ class SimpleTextDocValuesWriter extends DocValuesConsumer {final int length = value == null ? 0 : value.length;maxLength = Math.max(maxLength, length);}- writeFieldEntry(field, FieldInfo.DocValuesType.BINARY);+ writeFieldEntry(field, DocValuesType.BINARY);// write maxLengthSimpleTextUtil.write(data, MAXLENGTH);@@ -198,7 +198,7 @@ class SimpleTextDocValuesWriter extends DocValuesConsumer {public void addSortedField(FieldInfo field, Iterable<BytesRef> values, Iterable<Number> docToOrd) throws IOException {assert fieldSeen(field.name);assert field.getDocValuesType() == DocValuesType.SORTED;- writeFieldEntry(field, FieldInfo.DocValuesType.SORTED);+ writeFieldEntry(field, DocValuesType.SORTED);int valueCount = 0;int maxLength = -1;@@ -317,7 +317,7 @@ class SimpleTextDocValuesWriter extends DocValuesConsumer {public void addSortedSetField(FieldInfo field, Iterable<BytesRef> values, Iterable<Number> docToOrdCount, Iterable<Number> ords) throws IOException {assert fieldSeen(field.name);assert field.getDocValuesType() == DocValuesType.SORTED_SET;- writeFieldEntry(field, FieldInfo.DocValuesType.SORTED_SET);+ writeFieldEntry(field, DocValuesType.SORTED_SET);long valueCount = 0;int maxLength = 0;@@ -423,7 +423,7 @@ class SimpleTextDocValuesWriter extends DocValuesConsumer {}/** write the header for this field */- private void writeFieldEntry(FieldInfo field, FieldInfo.DocValuesType type) throws IOException {+ private void writeFieldEntry(FieldInfo field, DocValuesType type) throws IOException {SimpleTextUtil.write(data, FIELD);SimpleTextUtil.write(data, field.name, scratch);SimpleTextUtil.writeNewline(data);diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.javaindex df15b901583..b8a791d059a 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldInfosFormat.java@@ -24,12 +24,12 @@ import java.util.HashMap;import java.util.Map;import org.apache.lucene.codecs.FieldInfosFormat;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentInfo;-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.store.ChecksumIndexInput;import org.apache.lucene.store.Directory;import org.apache.lucene.store.IOContext;@@ -88,15 +88,10 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {assert StringHelper.startsWith(scratch.get(), NUMBER);int fieldNumber = Integer.parseInt(readString(NUMBER.length, scratch));- final IndexOptions indexOptions;SimpleTextUtil.readLine(input, scratch);assert StringHelper.startsWith(scratch.get(), INDEXOPTIONS);String s = readString(INDEXOPTIONS.length, scratch);- if ("null".equals(s)) {- indexOptions = null;- } else {- indexOptions = IndexOptions.valueOf(s);- }+ final IndexOptions indexOptions = IndexOptions.valueOf(s);SimpleTextUtil.readLine(input, scratch);assert StringHelper.startsWith(scratch.get(), STORETV);@@ -154,11 +149,7 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {}public DocValuesType docValuesType(String dvType) {- if ("false".equals(dvType)) {- return null;- } else {- return DocValuesType.valueOf(dvType);- }+ return DocValuesType.valueOf(dvType);}private String readString(int offset, BytesRefBuilder scratch) {@@ -187,12 +178,8 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {SimpleTextUtil.write(out, INDEXOPTIONS);IndexOptions indexOptions = fi.getIndexOptions();- if (indexOptions != null) {- assert fi.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.hasPayloads();- SimpleTextUtil.write(out, fi.getIndexOptions().toString(), scratch);- } else {- SimpleTextUtil.write(out, "null", scratch);- }+ assert indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.hasPayloads();+ SimpleTextUtil.write(out, indexOptions.toString(), scratch);SimpleTextUtil.writeNewline(out);SimpleTextUtil.write(out, STORETV);@@ -245,6 +232,6 @@ public class SimpleTextFieldInfosFormat extends FieldInfosFormat {}private static String getDocValuesType(DocValuesType type) {- return type == null ? "false" : type.toString();+ return type.toString();}}diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.javaindex 780c821de74..1b17a84fd34 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextFieldsReader.java@@ -17,16 +17,6 @@ package org.apache.lucene.codecs.simpletext;* limitations under the License.*/-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.DOC;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.END;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.END_OFFSET;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.FIELD;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.FREQ;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.PAYLOAD;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.POS;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.START_OFFSET;-import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.TERM;-import java.io.IOException;import java.nio.charset.StandardCharsets;import java.util.Collections;@@ -39,8 +29,8 @@ import org.apache.lucene.codecs.FieldsProducer;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfos;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;@@ -57,11 +47,9 @@ import org.apache.lucene.util.CharsRef;import org.apache.lucene.util.CharsRefBuilder;import org.apache.lucene.util.FixedBitSet;import org.apache.lucene.util.IOUtils;-import org.apache.lucene.util.IntsRef;import org.apache.lucene.util.IntsRefBuilder;import org.apache.lucene.util.RamUsageEstimator;import org.apache.lucene.util.StringHelper;-import org.apache.lucene.util.UnicodeUtil;import org.apache.lucene.util.fst.Builder;import org.apache.lucene.util.fst.BytesRefFSTEnum;import org.apache.lucene.util.fst.FST;@@ -69,6 +57,16 @@ import org.apache.lucene.util.fst.PairOutputs;import org.apache.lucene.util.fst.PositiveIntOutputs;import org.apache.lucene.util.fst.Util;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.DOC;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.END;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.END_OFFSET;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.FIELD;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.FREQ;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.PAYLOAD;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.POS;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.START_OFFSET;+import static org.apache.lucene.codecs.simpletext.SimpleTextFieldsWriter.TERM;+class SimpleTextFieldsReader extends FieldsProducer {private static final long BASE_RAM_BYTES_USED =@@ -205,7 +203,7 @@ class SimpleTextFieldsReader extends FieldsProducer {@Overridepublic long totalTermFreq() {- return indexOptions == IndexOptions.DOCS_ONLY ? -1 : totalTermFreq;+ return indexOptions == IndexOptions.DOCS ? -1 : totalTermFreq;}@Override@@ -216,7 +214,7 @@ class SimpleTextFieldsReader extends FieldsProducer {} else {docsEnum = new SimpleTextDocsEnum();}- return docsEnum.reset(docsStart, liveDocs, indexOptions == IndexOptions.DOCS_ONLY, docFreq);+ return docsEnum.reset(docsStart, liveDocs, indexOptions == IndexOptions.DOCS, docFreq);}@Override@@ -626,7 +624,7 @@ class SimpleTextFieldsReader extends FieldsProducer {@Overridepublic long getSumTotalTermFreq() {- return fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY ? -1 : sumTotalTermFreq;+ return fieldInfo.getIndexOptions() == IndexOptions.DOCS ? -1 : sumTotalTermFreq;}@Overridediff --git a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.javaindex 8b25bcb4016..7be2abc8911 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/DocValuesConsumer.java@@ -28,11 +28,11 @@ import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FilteredTermsEnum;import org.apache.lucene.index.MergeState;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.MultiDocValues.OrdinalMap;import org.apache.lucene.index.DocValues;import org.apache.lucene.index.NumericDocValues;-import org.apache.lucene.index.SegmentWriteState;+import org.apache.lucene.index.SegmentWriteState; // javadocsimport org.apache.lucene.index.SortedDocValues;import org.apache.lucene.index.SortedNumericDocValues;import org.apache.lucene.index.SortedSetDocValues;@@ -138,7 +138,7 @@ public abstract class DocValuesConsumer implements Closeable {for (FieldInfo mergeFieldInfo : mergeState.mergeFieldInfos) {DocValuesType type = mergeFieldInfo.getDocValuesType();- if (type != null) {+ if (type != DocValuesType.NO) {if (type == DocValuesType.NUMERIC) {List<NumericDocValues> toMerge = new ArrayList<>();List<Bits> docsWithField = new ArrayList<>();diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.java b/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.javaindex 0ce70324612..73d1659cee3 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/PushPostingsWriterBase.java@@ -21,8 +21,8 @@ import java.io.IOException;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.FixedBitSet;diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.javaindex e01288eccbe..ab61a647328 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java@@ -28,9 +28,9 @@ import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.FieldsProducer;import org.apache.lucene.codecs.PostingsReaderBase;import org.apache.lucene.index.CorruptIndexException;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.Terms;import org.apache.lucene.store.IndexInput;@@ -170,7 +170,7 @@ public final class BlockTreeTermsReader extends FieldsProducer {if (fieldInfo == null) {throw new CorruptIndexException("invalid field number: " + field, termsIn);}- final long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY ? -1 : termsIn.readVLong();+ final long sumTotalTermFreq = fieldInfo.getIndexOptions() == IndexOptions.DOCS ? -1 : termsIn.readVLong();final long sumDocFreq = termsIn.readVLong();final int docCount = termsIn.readVInt();final int longsSize = termsIn.readVInt();diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.javaindex d9b36762ea2..f8dafdd9f71 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java@@ -25,11 +25,11 @@ import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.FieldsConsumer;import org.apache.lucene.codecs.PostingsWriterBase;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;@@ -695,7 +695,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {// Write term stats, to separate byte[] blob:statsWriter.writeVInt(state.docFreq);- if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) {assert state.totalTermFreq >= state.docFreq: state.totalTermFreq + " vs " + state.docFreq;statsWriter.writeVLong(state.totalTermFreq - state.docFreq);}@@ -736,7 +736,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {// Write term stats, to separate byte[] blob:statsWriter.writeVInt(state.docFreq);- if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS) {assert state.totalTermFreq >= state.docFreq;statsWriter.writeVLong(state.totalTermFreq - state.docFreq);}@@ -824,6 +824,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {TermsWriter(FieldInfo fieldInfo) {this.fieldInfo = fieldInfo;+ assert fieldInfo.getIndexOptions() != IndexOptions.NO;docsSeen = new FixedBitSet(maxDoc);this.longsSize = postingsWriter.setField(fieldInfo);@@ -843,7 +844,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {BlockTermState state = postingsWriter.writeTerm(text, termsEnum, docsSeen);if (state != null) {assert state.docFreq != 0;- assert fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;+ assert fieldInfo.getIndexOptions() == IndexOptions.DOCS || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;sumDocFreq += state.docFreq;sumTotalTermFreq += state.totalTermFreq;pushTerm(text);@@ -944,7 +945,7 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {longsSize,minTerm, maxTerm));} else {- assert sumTotalTermFreq == 0 || fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY && sumTotalTermFreq == -1;+ assert sumTotalTermFreq == 0 || fieldInfo.getIndexOptions() == IndexOptions.DOCS && sumTotalTermFreq == -1;assert sumDocFreq == 0;assert docsSeen.cardinality() == 0;}@@ -974,7 +975,8 @@ public final class BlockTreeTermsWriter extends FieldsConsumer {termsOut.writeVLong(field.numTerms);termsOut.writeVInt(field.rootCode.length);termsOut.writeBytes(field.rootCode.bytes, field.rootCode.offset, field.rootCode.length);- if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ assert field.fieldInfo.getIndexOptions() != IndexOptions.NO;+ if (field.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {termsOut.writeVLong(field.sumTotalTermFreq);}termsOut.writeVLong(field.sumDocFreq);diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.javaindex 67d0dfbe457..7ec70532099 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/FieldReader.java@@ -21,7 +21,7 @@ import java.io.IOException;import java.util.Collections;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.ByteArrayDataInput;diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.javaindex a7c6ac01f98..952d226afd3 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java@@ -21,7 +21,7 @@ import java.io.IOException;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermState;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.IndexInput;diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.javaindex 1bb0a931a04..06ab6aa6853 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnumFrame.java@@ -20,7 +20,7 @@ package org.apache.lucene.codecs.blocktree;import java.io.IOException;import org.apache.lucene.codecs.BlockTermState;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.store.ByteArrayDataInput;import org.apache.lucene.util.ArrayUtil;import org.apache.lucene.util.BytesRef;@@ -278,7 +278,7 @@ final class IntersectTermsEnumFrame {// statstermState.docFreq = statsReader.readVInt();//if (DEBUG) System.out.println(" dF=" + state.docFreq);- if (ite.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (ite.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {termState.totalTermFreq = termState.docFreq + statsReader.readVLong();//if (DEBUG) System.out.println(" totTF=" + state.totalTermFreq);}diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.javaindex 59ceb5400e0..df67b07e4bf 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java@@ -23,7 +23,7 @@ import java.io.PrintStream;import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermState;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.ByteArrayDataInput;diff --git a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.java b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.javaindex f69220e0d9a..15d6a91084c 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnumFrame.java@@ -20,7 +20,7 @@ package org.apache.lucene.codecs.blocktree;import java.io.IOException;import org.apache.lucene.codecs.BlockTermState;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermsEnum.SeekStatus;import org.apache.lucene.store.ByteArrayDataInput;import org.apache.lucene.util.ArrayUtil;@@ -403,7 +403,7 @@ final class SegmentTermsEnumFrame {// statsstate.docFreq = statsReader.readVInt();//if (DEBUG) System.out.println(" dF=" + state.docFreq);- if (ste.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS_ONLY) {+ if (ste.fr.fieldInfo.getIndexOptions() != IndexOptions.DOCS) {state.totalTermFreq = state.docFreq + statsReader.readVLong();//if (DEBUG) System.out.println(" totTF=" + state.totalTermFreq);}diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50DocValuesFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50DocValuesFormat.javaindex c5808053260..5027b292299 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50DocValuesFormat.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50DocValuesFormat.java@@ -21,11 +21,11 @@ import java.io.IOException;import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.DocValuesConsumer;-import org.apache.lucene.codecs.DocValuesProducer;import org.apache.lucene.codecs.DocValuesFormat;+import org.apache.lucene.codecs.DocValuesProducer;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.SegmentWriteState;-import org.apache.lucene.index.FieldInfo.DocValuesType;import org.apache.lucene.store.DataOutput;import org.apache.lucene.util.SmallFloat;import org.apache.lucene.util.fst.FST;diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.javaindex 555ce32ecd1..83f1b80218e 100755--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java@@ -25,12 +25,12 @@ import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.DocValuesFormat;import org.apache.lucene.codecs.FieldInfosFormat;import org.apache.lucene.index.CorruptIndexException;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentInfo;-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.store.ChecksumIndexInput;import org.apache.lucene.store.DataOutput;import org.apache.lucene.store.Directory;@@ -159,35 +159,33 @@ public final class Lucene50FieldInfosFormat extends FieldInfosFormat {static {// We "mirror" DocValues enum values with the constants below; let's try to ensure if we add a new DocValuesType while this format is// still used for writing, we remember to fix this encoding:- assert DocValuesType.values().length == 5;+ assert DocValuesType.values().length == 6;}private static byte docValuesByte(DocValuesType type) {- if (type == null) {+ switch(type) {+ case NO:return 0;- } else {- switch(type) {- case NUMERIC:- return 1;- case BINARY:- return 2;- case SORTED:- return 3;- case SORTED_SET:- return 4;- case SORTED_NUMERIC:- return 5;- default:- // BUG- throw new AssertionError("unhandled DocValuesType: " + type);- }+ case NUMERIC:+ return 1;+ case BINARY:+ return 2;+ case SORTED:+ return 3;+ case SORTED_SET:+ return 4;+ case SORTED_NUMERIC:+ return 5;+ default:+ // BUG+ throw new AssertionError("unhandled DocValuesType: " + type);}}private static DocValuesType getDocValuesType(IndexInput input, byte b) throws IOException {switch(b) {case 0:- return null;+ return DocValuesType.NO;case 1:return DocValuesType.NUMERIC;case 2:@@ -206,35 +204,33 @@ public final class Lucene50FieldInfosFormat extends FieldInfosFormat {static {// We "mirror" IndexOptions enum values with the constants below; let's try to ensure if we add a new IndexOption while this format is// still used for writing, we remember to fix this encoding:- assert IndexOptions.values().length == 4;+ assert IndexOptions.values().length == 5;}private static byte indexOptionsByte(IndexOptions indexOptions) {- if (indexOptions == null) {+ switch (indexOptions) {+ case NO:return 0;- } else {- switch (indexOptions) {- case DOCS_ONLY:- return 1;- case DOCS_AND_FREQS:- return 2;- case DOCS_AND_FREQS_AND_POSITIONS:- return 3;- case DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS:- return 4;- default:- // BUG:- throw new AssertionError("unhandled IndexOptions: " + indexOptions);- }+ case DOCS:+ return 1;+ case DOCS_AND_FREQS:+ return 2;+ case DOCS_AND_FREQS_AND_POSITIONS:+ return 3;+ case DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS:+ return 4;+ default:+ // BUG:+ throw new AssertionError("unhandled IndexOptions: " + indexOptions);}}private static IndexOptions getIndexOptions(IndexInput input, byte b) throws IOException {switch (b) {case 0:- return null;+ return IndexOptions.NO;case 1:- return IndexOptions.DOCS_ONLY;+ return IndexOptions.DOCS;case 2:return IndexOptions.DOCS_AND_FREQS;case 3:diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.javaindex 9fa4b1ae924..56742daff58 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsFormat.java@@ -31,7 +31,7 @@ import org.apache.lucene.codecs.PostingsWriterBase;import org.apache.lucene.codecs.blocktree.BlockTreeTermsReader;import org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.TermState;@@ -186,7 +186,7 @@ import org.apache.lucene.util.packed.PackedInts;** <p>The .doc file contains the lists of documents which contain each term, along* with the frequency of the term in that document (except when frequencies are- * omitted: {@link IndexOptions#DOCS_ONLY}). It also saves skip data to the beginning of+ * omitted: {@link IndexOptions#DOCS}). It also saves skip data to the beginning of* each packed or VInt block, when the length of document list is larger than packed block size.</p>** <ul>@@ -232,7 +232,7 @@ import org.apache.lucene.util.packed.PackedInts;* and three times in document eleven, with frequencies indexed, would be the* following sequence of VInts:</p>* <p>15, 8, 3</p>- * <p>If frequencies were omitted ({@link IndexOptions#DOCS_ONLY}) it would be this+ * <p>If frequencies were omitted ({@link IndexOptions#DOCS}) it would be this* sequence of VInts instead:</p>* <p>7,4</p>* </li>diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.javaindex 97ac608875e..31d3314269d 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50PostingsReader.java@@ -17,17 +17,6 @@ package org.apache.lucene.codecs.lucene50;* limitations under the License.*/-import static org.apache.lucene.codecs.lucene50.ForUtil.MAX_DATA_SIZE;-import static org.apache.lucene.codecs.lucene50.ForUtil.MAX_ENCODED_SIZE;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.BLOCK_SIZE;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.DOC_CODEC;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.MAX_SKIP_LEVELS;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.PAY_CODEC;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.POS_CODEC;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.TERMS_CODEC;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.VERSION_CURRENT;-import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.VERSION_START;-import java.io.IOException;import java.util.Arrays;import java.util.Collections;@@ -39,8 +28,8 @@ import org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.IntBlockTermStatimport org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.store.DataInput;import org.apache.lucene.store.IndexInput;@@ -51,6 +40,17 @@ import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.IOUtils;import org.apache.lucene.util.RamUsageEstimator;+import static org.apache.lucene.codecs.lucene50.ForUtil.MAX_DATA_SIZE;+import static org.apache.lucene.codecs.lucene50.ForUtil.MAX_ENCODED_SIZE;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.BLOCK_SIZE;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.DOC_CODEC;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.MAX_SKIP_LEVELS;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.PAY_CODEC;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.POS_CODEC;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.TERMS_CODEC;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.VERSION_CURRENT;+import static org.apache.lucene.codecs.lucene50.Lucene50PostingsFormat.VERSION_START;+/*** Concrete class that reads docId(maybe frq,pos,offset,payloads) list* with postings format.diff --git a/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.javaindex d6bbe6658f4..e80dc30070b 100644--- a/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.java+++ b/lucene/core/src/java/org/apache/lucene/document/BinaryDocValuesField.java@@ -18,7 +18,7 @@ package org.apache.lucene.document;*/import org.apache.lucene.index.BinaryDocValues;-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.util.BytesRef;/**@@ -46,7 +46,7 @@ public class BinaryDocValuesField extends Field {*/public static final FieldType TYPE = new FieldType();static {- TYPE.setDocValueType(FieldInfo.DocValuesType.BINARY);+ TYPE.setDocValueType(DocValuesType.BINARY);TYPE.freeze();}diff --git a/lucene/core/src/java/org/apache/lucene/document/Document.java b/lucene/core/src/java/org/apache/lucene/document/Document.javaindex 50bb4ed57ba..ecf6328d393 100644--- a/lucene/core/src/java/org/apache/lucene/document/Document.java+++ b/lucene/core/src/java/org/apache/lucene/document/Document.java@@ -19,7 +19,9 @@ package org.apache.lucene.document;import java.util.*;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.IndexDocument;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader; // for javadocimport org.apache.lucene.index.IndexableField;import org.apache.lucene.index.StorableField;@@ -310,7 +312,7 @@ public final class Document implements IndexDocument {return new FilterIterator<StorableField, Field>(fields.iterator()) {@Overrideprotected boolean predicateFunction(Field field) {- return field.type.stored() || field.type.docValueType() != null;+ return field.type.stored() || field.type.docValueType() != DocValuesType.NO;}};}@@ -319,7 +321,7 @@ public final class Document implements IndexDocument {return new FilterIterator<IndexableField, Field>(fields.iterator()) {@Overrideprotected boolean predicateFunction(Field field) {- return field.type.indexOptions() != null;+ return field.type.indexOptions() != IndexOptions.NO;}};}diff --git a/lucene/core/src/java/org/apache/lucene/document/DoubleField.java b/lucene/core/src/java/org/apache/lucene/document/DoubleField.javaindex 1c874a7f077..cebc4419d6a 100644--- a/lucene/core/src/java/org/apache/lucene/document/DoubleField.java+++ b/lucene/core/src/java/org/apache/lucene/document/DoubleField.java@@ -18,7 +18,7 @@ package org.apache.lucene.document;*/import org.apache.lucene.analysis.NumericTokenStream; // javadocs-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.search.NumericRangeFilter; // javadocsimport org.apache.lucene.search.NumericRangeQuery; // javadocsimport org.apache.lucene.util.NumericUtils;@@ -121,7 +121,7 @@ public final class DoubleField extends Field {static {TYPE_NOT_STORED.setTokenized(true);TYPE_NOT_STORED.setOmitNorms(true);- TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_NOT_STORED.setNumericType(FieldType.NumericType.DOUBLE);TYPE_NOT_STORED.freeze();}@@ -134,7 +134,7 @@ public final class DoubleField extends Field {static {TYPE_STORED.setTokenized(true);TYPE_STORED.setOmitNorms(true);- TYPE_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_STORED.setNumericType(FieldType.NumericType.DOUBLE);TYPE_STORED.setStored(true);TYPE_STORED.freeze();diff --git a/lucene/core/src/java/org/apache/lucene/document/Field.java b/lucene/core/src/java/org/apache/lucene/document/Field.javaindex 4e1b66d2af9..7cd4f4b7063 100644--- a/lucene/core/src/java/org/apache/lucene/document/Field.java+++ b/lucene/core/src/java/org/apache/lucene/document/Field.java@@ -26,12 +26,13 @@ import org.apache.lucene.analysis.TokenStream;import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;import org.apache.lucene.document.FieldType.NumericType;+import org.apache.lucene.index.FieldInvertState; // javadocs+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexWriter; // javadocsimport org.apache.lucene.index.IndexableField;import org.apache.lucene.index.IndexableFieldType;import org.apache.lucene.index.StorableField;import org.apache.lucene.util.BytesRef;-import org.apache.lucene.index.FieldInvertState; // javadocs/*** Expert: directly create a field for a document. Most@@ -122,7 +123,7 @@ public class Field implements IndexableField, StorableField {if (type.stored()) {throw new IllegalArgumentException("fields with a Reader value cannot be stored");}- if (type.indexOptions() != null && !type.tokenized()) {+ if (type.indexOptions() != IndexOptions.NO && !type.tokenized()) {throw new IllegalArgumentException("non-tokenized fields must use String values");}@@ -148,7 +149,7 @@ public class Field implements IndexableField, StorableField {if (tokenStream == null) {throw new NullPointerException("tokenStream cannot be null");}- if (type.indexOptions() == null || !type.tokenized()) {+ if (type.indexOptions() == IndexOptions.NO || !type.tokenized()) {throw new IllegalArgumentException("TokenStream fields must be indexed and tokenized");}if (type.stored()) {@@ -214,7 +215,7 @@ public class Field implements IndexableField, StorableField {if (bytes == null) {throw new IllegalArgumentException("bytes cannot be null");}- if (type.indexOptions() != null) {+ if (type.indexOptions() != IndexOptions.NO) {throw new IllegalArgumentException("Fields with BytesRef values cannot be indexed");}this.fieldsData = bytes;@@ -241,7 +242,7 @@ public class Field implements IndexableField, StorableField {if (value == null) {throw new IllegalArgumentException("value cannot be null");}- if (!type.stored() && type.indexOptions() == null) {+ if (!type.stored() && type.indexOptions() == IndexOptions.NO) {throw new IllegalArgumentException("it doesn't make sense to have a field that "+ "is neither indexed nor stored");}@@ -338,7 +339,7 @@ public class Field implements IndexableField, StorableField {if (!(fieldsData instanceof BytesRef)) {throw new IllegalArgumentException("cannot change value type from " + fieldsData.getClass().getSimpleName() + " to BytesRef");}- if (type.indexOptions() != null) {+ if (type.indexOptions() != IndexOptions.NO) {throw new IllegalArgumentException("cannot set a BytesRef value on an indexed field");}if (value == null) {@@ -419,7 +420,7 @@ public class Field implements IndexableField, StorableField {* values from stringValue() or getBinaryValue()*/public void setTokenStream(TokenStream tokenStream) {- if (type.indexOptions() == null || !type.tokenized()) {+ if (type.indexOptions() == IndexOptions.NO || !type.tokenized()) {throw new IllegalArgumentException("TokenStream fields must be indexed and tokenized");}if (type.numericType() != null) {@@ -452,7 +453,7 @@ public class Field implements IndexableField, StorableField {*/public void setBoost(float boost) {if (boost != 1.0f) {- if (type.indexOptions() == null || type.omitNorms()) {+ if (type.indexOptions() == IndexOptions.NO || type.omitNorms()) {throw new IllegalArgumentException("You cannot set an index-time boost on an unindexed field, or one that omits norms");}}@@ -502,7 +503,7 @@ public class Field implements IndexableField, StorableField {@Overridepublic TokenStream tokenStream(Analyzer analyzer, TokenStream reuse) throws IOException {- if (fieldType().indexOptions() == null) {+ if (fieldType().indexOptions() == IndexOptions.NO) {// Not indexedreturn null;}diff --git a/lucene/core/src/java/org/apache/lucene/document/FieldType.java b/lucene/core/src/java/org/apache/lucene/document/FieldType.javaindex 20ee3d7c7d1..603ffed75dd 100644--- a/lucene/core/src/java/org/apache/lucene/document/FieldType.java+++ b/lucene/core/src/java/org/apache/lucene/document/FieldType.java@@ -18,8 +18,8 @@ package org.apache.lucene.document;*/import org.apache.lucene.analysis.Analyzer; // javadocs-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.DocValuesType;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexableFieldType;import org.apache.lucene.search.NumericRangeQuery; // javadocsimport org.apache.lucene.util.NumericUtils;@@ -50,11 +50,11 @@ public class FieldType implements IndexableFieldType {private boolean storeTermVectorPositions;private boolean storeTermVectorPayloads;private boolean omitNorms;- private IndexOptions indexOptions;+ private IndexOptions indexOptions = IndexOptions.NO;private NumericType numericType;private boolean frozen;private int numericPrecisionStep = NumericUtils.PRECISION_STEP_DEFAULT;- private DocValuesType docValueType;+ private DocValuesType docValueType = DocValuesType.NO;/*** Create a new mutable FieldType with all of the properties from <code>ref</code>@@ -263,7 +263,7 @@ public class FieldType implements IndexableFieldType {* {@inheritDoc}* <p>* The default is {@link IndexOptions#DOCS_AND_FREQS_AND_POSITIONS}.- * @see #setIndexOptions(org.apache.lucene.index.FieldInfo.IndexOptions)+ * @see #setIndexOptions(IndexOptions)*/@Overridepublic IndexOptions indexOptions() {@@ -279,6 +279,9 @@ public class FieldType implements IndexableFieldType {*/public void setIndexOptions(IndexOptions value) {checkIfFrozen();+ if (value == null) {+ throw new NullPointerException("IndexOptions cannot be null");+ }this.indexOptions = value;}@@ -341,7 +344,7 @@ public class FieldType implements IndexableFieldType {if (stored()) {result.append("stored");}- if (indexOptions != null) {+ if (indexOptions != IndexOptions.NO) {if (result.length() > 0)result.append(",");result.append("indexed");@@ -374,9 +377,10 @@ public class FieldType implements IndexableFieldType {result.append(numericPrecisionStep);}}- if (docValueType != null) {- if (result.length() > 0)+ if (docValueType != DocValuesType.NO) {+ if (result.length() > 0) {result.append(",");+ }result.append("docValueType=");result.append(docValueType);}@@ -390,7 +394,7 @@ public class FieldType implements IndexableFieldType {* {@inheritDoc}* <p>* The default is <code>null</code> (no docValues)- * @see #setDocValueType(org.apache.lucene.index.FieldInfo.DocValuesType)+ * @see #setDocValueType(DocValuesType)*/@Overridepublic DocValuesType docValueType() {@@ -406,6 +410,9 @@ public class FieldType implements IndexableFieldType {*/public void setDocValueType(DocValuesType type) {checkIfFrozen();+ if (type == null) {+ throw new NullPointerException("DocValuesType cannot be null");+ }docValueType = type;}@@ -414,7 +421,7 @@ public class FieldType implements IndexableFieldType {final int prime = 31;int result = 1;result = prime * result + ((docValueType == null) ? 0 : docValueType.hashCode());- result = prime * result + ((indexOptions == null) ? 0 : indexOptions.hashCode());+ result = prime * result + indexOptions.hashCode();result = prime * result + numericPrecisionStep;result = prime * result + ((numericType == null) ? 0 : numericType.hashCode());result = prime * result + (omitNorms ? 1231 : 1237);diff --git a/lucene/core/src/java/org/apache/lucene/document/FloatField.java b/lucene/core/src/java/org/apache/lucene/document/FloatField.javaindex 610ad5ef6af..a959a73aafa 100644--- a/lucene/core/src/java/org/apache/lucene/document/FloatField.java+++ b/lucene/core/src/java/org/apache/lucene/document/FloatField.java@@ -18,7 +18,7 @@ package org.apache.lucene.document;*/import org.apache.lucene.analysis.NumericTokenStream; // javadocs-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.search.NumericRangeFilter; // javadocsimport org.apache.lucene.search.NumericRangeQuery; // javadocsimport org.apache.lucene.util.NumericUtils;@@ -121,7 +121,7 @@ public final class FloatField extends Field {static {TYPE_NOT_STORED.setTokenized(true);TYPE_NOT_STORED.setOmitNorms(true);- TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_NOT_STORED.setNumericType(FieldType.NumericType.FLOAT);TYPE_NOT_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);TYPE_NOT_STORED.freeze();@@ -135,7 +135,7 @@ public final class FloatField extends Field {static {TYPE_STORED.setTokenized(true);TYPE_STORED.setOmitNorms(true);- TYPE_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_STORED.setNumericType(FieldType.NumericType.FLOAT);TYPE_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);TYPE_STORED.setStored(true);diff --git a/lucene/core/src/java/org/apache/lucene/document/IntField.java b/lucene/core/src/java/org/apache/lucene/document/IntField.javaindex bd25df3a4f9..4910805e86d 100644--- a/lucene/core/src/java/org/apache/lucene/document/IntField.java+++ b/lucene/core/src/java/org/apache/lucene/document/IntField.java@@ -18,7 +18,7 @@ package org.apache.lucene.document;*/import org.apache.lucene.analysis.NumericTokenStream; // javadocs-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.search.NumericRangeFilter; // javadocsimport org.apache.lucene.search.NumericRangeQuery; // javadocsimport org.apache.lucene.util.NumericUtils;@@ -121,7 +121,7 @@ public final class IntField extends Field {static {TYPE_NOT_STORED.setTokenized(true);TYPE_NOT_STORED.setOmitNorms(true);- TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_NOT_STORED.setNumericType(FieldType.NumericType.INT);TYPE_NOT_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);TYPE_NOT_STORED.freeze();@@ -135,7 +135,7 @@ public final class IntField extends Field {static {TYPE_STORED.setTokenized(true);TYPE_STORED.setOmitNorms(true);- TYPE_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_STORED.setNumericType(FieldType.NumericType.INT);TYPE_STORED.setNumericPrecisionStep(NumericUtils.PRECISION_STEP_DEFAULT_32);TYPE_STORED.setStored(true);diff --git a/lucene/core/src/java/org/apache/lucene/document/LongField.java b/lucene/core/src/java/org/apache/lucene/document/LongField.javaindex c56e2703d52..9dad385b976 100644--- a/lucene/core/src/java/org/apache/lucene/document/LongField.java+++ b/lucene/core/src/java/org/apache/lucene/document/LongField.java@@ -18,7 +18,7 @@ package org.apache.lucene.document;*/import org.apache.lucene.analysis.NumericTokenStream; // javadocs-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.search.NumericRangeFilter; // javadocsimport org.apache.lucene.search.NumericRangeQuery; // javadocsimport org.apache.lucene.util.NumericUtils;@@ -131,7 +131,7 @@ public final class LongField extends Field {static {TYPE_NOT_STORED.setTokenized(true);TYPE_NOT_STORED.setOmitNorms(true);- TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_NOT_STORED.setNumericType(FieldType.NumericType.LONG);TYPE_NOT_STORED.freeze();}@@ -144,7 +144,7 @@ public final class LongField extends Field {static {TYPE_STORED.setTokenized(true);TYPE_STORED.setOmitNorms(true);- TYPE_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_STORED.setNumericType(FieldType.NumericType.LONG);TYPE_STORED.setStored(true);TYPE_STORED.freeze();diff --git a/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.javaindex 2444a8579a4..1cea3001b14 100644--- a/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.java+++ b/lucene/core/src/java/org/apache/lucene/document/NumericDocValuesField.java@@ -17,7 +17,7 @@ package org.apache.lucene.document;* limitations under the License.*/-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.DocValuesType;/*** <p>@@ -40,7 +40,7 @@ public class NumericDocValuesField extends Field {*/public static final FieldType TYPE = new FieldType();static {- TYPE.setDocValueType(FieldInfo.DocValuesType.NUMERIC);+ TYPE.setDocValueType(DocValuesType.NUMERIC);TYPE.freeze();}diff --git a/lucene/core/src/java/org/apache/lucene/document/SortedDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/SortedDocValuesField.javaindex 926a48eca04..23032ca8381 100644--- a/lucene/core/src/java/org/apache/lucene/document/SortedDocValuesField.java+++ b/lucene/core/src/java/org/apache/lucene/document/SortedDocValuesField.java@@ -17,7 +17,7 @@ package org.apache.lucene.document;* limitations under the License.*/-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.util.BytesRef;/**@@ -43,7 +43,7 @@ public class SortedDocValuesField extends Field {*/public static final FieldType TYPE = new FieldType();static {- TYPE.setDocValueType(FieldInfo.DocValuesType.SORTED);+ TYPE.setDocValueType(DocValuesType.SORTED);TYPE.freeze();}diff --git a/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesField.javaindex 5af1aca8ba2..3819461fcb2 100644--- a/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesField.java+++ b/lucene/core/src/java/org/apache/lucene/document/SortedNumericDocValuesField.java@@ -17,7 +17,7 @@ package org.apache.lucene.document;* limitations under the License.*/-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.util.NumericUtils;/**@@ -50,7 +50,7 @@ public class SortedNumericDocValuesField extends Field {*/public static final FieldType TYPE = new FieldType();static {- TYPE.setDocValueType(FieldInfo.DocValuesType.SORTED_NUMERIC);+ TYPE.setDocValueType(DocValuesType.SORTED_NUMERIC);TYPE.freeze();}diff --git a/lucene/core/src/java/org/apache/lucene/document/SortedSetDocValuesField.java b/lucene/core/src/java/org/apache/lucene/document/SortedSetDocValuesField.javaindex 189fa3f27ed..e8e823ae788 100644--- a/lucene/core/src/java/org/apache/lucene/document/SortedSetDocValuesField.java+++ b/lucene/core/src/java/org/apache/lucene/document/SortedSetDocValuesField.java@@ -17,7 +17,7 @@ package org.apache.lucene.document;* limitations under the License.*/-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.util.BytesRef;/**@@ -44,7 +44,7 @@ public class SortedSetDocValuesField extends Field {*/public static final FieldType TYPE = new FieldType();static {- TYPE.setDocValueType(FieldInfo.DocValuesType.SORTED_SET);+ TYPE.setDocValueType(DocValuesType.SORTED_SET);TYPE.freeze();}diff --git a/lucene/core/src/java/org/apache/lucene/document/StringField.java b/lucene/core/src/java/org/apache/lucene/document/StringField.javaindex aa014b98464..e9603070a2b 100644--- a/lucene/core/src/java/org/apache/lucene/document/StringField.java+++ b/lucene/core/src/java/org/apache/lucene/document/StringField.java@@ -17,7 +17,7 @@ package org.apache.lucene.document;* limitations under the License.*/-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;/** A field that is indexed but not tokenized: the entire* String value is indexed as a single token. For example@@ -37,12 +37,12 @@ public final class StringField extends Field {static {TYPE_NOT_STORED.setOmitNorms(true);- TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_NOT_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_NOT_STORED.setTokenized(false);TYPE_NOT_STORED.freeze();TYPE_STORED.setOmitNorms(true);- TYPE_STORED.setIndexOptions(IndexOptions.DOCS_ONLY);+ TYPE_STORED.setIndexOptions(IndexOptions.DOCS);TYPE_STORED.setStored(true);TYPE_STORED.setTokenized(false);TYPE_STORED.freeze();diff --git a/lucene/core/src/java/org/apache/lucene/document/TextField.java b/lucene/core/src/java/org/apache/lucene/document/TextField.javaindex 82f9016a73b..b6a305335b6 100644--- a/lucene/core/src/java/org/apache/lucene/document/TextField.java+++ b/lucene/core/src/java/org/apache/lucene/document/TextField.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.IndexOptions;/** A field that is indexed and tokenized, without term* vectors. For example this would be used on a 'body'diff --git a/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java b/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.javaindex a7735cf1989..a5b817f0509 100644--- a/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java+++ b/lucene/core/src/java/org/apache/lucene/index/BinaryDocValuesFieldUpdates.java@@ -1,15 +1,5 @@package org.apache.lucene.index;-import org.apache.lucene.document.BinaryDocValuesField;-import org.apache.lucene.search.DocIdSetIterator;-import org.apache.lucene.util.ArrayUtil;-import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.BytesRefBuilder;-import org.apache.lucene.util.InPlaceMergeSorter;-import org.apache.lucene.util.packed.PackedInts;-import org.apache.lucene.util.packed.PagedGrowableWriter;-import org.apache.lucene.util.packed.PagedMutable;-/** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. See the NOTICE file distributed with@@ -27,6 +17,15 @@ import org.apache.lucene.util.packed.PagedMutable;* limitations under the License.*/+import org.apache.lucene.document.BinaryDocValuesField;+import org.apache.lucene.search.DocIdSetIterator;+import org.apache.lucene.util.BytesRef;+import org.apache.lucene.util.BytesRefBuilder;+import org.apache.lucene.util.InPlaceMergeSorter;+import org.apache.lucene.util.packed.PackedInts;+import org.apache.lucene.util.packed.PagedGrowableWriter;+import org.apache.lucene.util.packed.PagedMutable;+/*** A {@link DocValuesFieldUpdates} which holds updates of documents, of a single* {@link BinaryDocValuesField}.@@ -102,7 +101,7 @@ class BinaryDocValuesFieldUpdates extends DocValuesFieldUpdates {private final int bitsPerValue;public BinaryDocValuesFieldUpdates(String field, int maxDoc) {- super(field, FieldInfo.DocValuesType.BINARY);+ super(field, DocValuesType.BINARY);bitsPerValue = PackedInts.bitsRequired(maxDoc - 1);docs = new PagedMutable(1, PAGE_SIZE, bitsPerValue, PackedInts.COMPACT);offsets = new PagedGrowableWriter(1, PAGE_SIZE, 1, PackedInts.FAST);diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.javaindex ef008218022..60bdf1dd220 100644--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java@@ -33,7 +33,6 @@ import java.util.Map;import org.apache.lucene.codecs.Codec;import org.apache.lucene.codecs.PostingsFormat;import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.store.AlreadyClosedException;import org.apache.lucene.store.Directory;diff --git a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.javaindex 3f28985f559..461443acfa7 100644--- a/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java+++ b/lucene/core/src/java/org/apache/lucene/index/DefaultIndexingChain.java@@ -29,8 +29,6 @@ import org.apache.lucene.codecs.NormsConsumer;import org.apache.lucene.codecs.NormsFormat;import org.apache.lucene.codecs.StoredFieldsWriter;import org.apache.lucene.document.FieldType;-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.similarities.Similarity;import org.apache.lucene.store.IOContext;import org.apache.lucene.util.ArrayUtil;@@ -364,7 +362,10 @@ final class DefaultIndexingChain extends DocConsumer {}DocValuesType dvType = fieldType.docValueType();- if (dvType != null) {+ if (dvType == null) {+ throw new NullPointerException("docValueType cannot be null (field: \"" + fieldName + "\")");+ }+ if (dvType != DocValuesType.NO) {indexDocValue(fp, dvType, field);}}@@ -378,7 +379,7 @@ final class DefaultIndexingChain extends DocConsumer {}private static void verifyFieldType(String name, IndexableFieldType ft) {- if (ft.indexOptions() == null) {+ if (ft.indexOptions() == IndexOptions.NO) {if (ft.storeTermVectors()) {throw new IllegalArgumentException("cannot store term vectors "+ "for a field that is not indexed (field=\"" + name + "\")");diff --git a/lucene/core/src/java/org/apache/lucene/index/DocValuesFieldUpdates.java b/lucene/core/src/java/org/apache/lucene/index/DocValuesFieldUpdates.javaindex 7db6a7a4fa7..0729c888411 100644--- a/lucene/core/src/java/org/apache/lucene/index/DocValuesFieldUpdates.java+++ b/lucene/core/src/java/org/apache/lucene/index/DocValuesFieldUpdates.java@@ -1,12 +1,5 @@package org.apache.lucene.index;-import java.util.HashMap;-import java.util.Map;--import org.apache.lucene.index.NumericDocValuesFieldUpdates;-import org.apache.lucene.search.DocIdSetIterator;-import org.apache.lucene.util.packed.PagedGrowableWriter;-/** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. See the NOTICE file distributed with@@ -24,6 +17,12 @@ import org.apache.lucene.util.packed.PagedGrowableWriter;* limitations under the License.*/+import java.util.HashMap;+import java.util.Map;++import org.apache.lucene.search.DocIdSetIterator;+import org.apache.lucene.util.packed.PagedGrowableWriter;+/*** Holds updates of a single DocValues field, for a set of documents.*@@ -98,7 +97,7 @@ abstract class DocValuesFieldUpdates {return ramBytesPerDoc;}- DocValuesFieldUpdates getUpdates(String field, FieldInfo.DocValuesType type) {+ DocValuesFieldUpdates getUpdates(String field, DocValuesType type) {switch (type) {case NUMERIC:return numericDVUpdates.get(field);@@ -109,7 +108,7 @@ abstract class DocValuesFieldUpdates {}}- DocValuesFieldUpdates newUpdates(String field, FieldInfo.DocValuesType type, int maxDoc) {+ DocValuesFieldUpdates newUpdates(String field, DocValuesType type, int maxDoc) {switch (type) {case NUMERIC:assert numericDVUpdates.get(field) == null;@@ -133,10 +132,13 @@ abstract class DocValuesFieldUpdates {}final String field;- final FieldInfo.DocValuesType type;+ final DocValuesType type;- protected DocValuesFieldUpdates(String field, FieldInfo.DocValuesType type) {+ protected DocValuesFieldUpdates(String field, DocValuesType type) {this.field = field;+ if (type == null) {+ throw new NullPointerException("DocValuesType cannot be null");+ }this.type = type;}diff --git a/lucene/core/src/java/org/apache/lucene/index/DocValuesType.java b/lucene/core/src/java/org/apache/lucene/index/DocValuesType.javanew file mode 100644index 00000000000..cb1ca37a355--- /dev/null+++ b/lucene/core/src/java/org/apache/lucene/index/DocValuesType.java@@ -0,0 +1,59 @@+package org.apache.lucene.index;++/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+++/**+ * DocValues types. Note that DocValues is strongly typed, so a+ * field cannot have different types across different documents.+ */+public enum DocValuesType {+ /**+ * No doc values for this field.+ */+ NO,+ /**+ * A per-document Number+ */+ NUMERIC,+ /**+ * A per-document byte[]. Values may be larger than+ * 32766 bytes, but different codecs may enforce their own limits.+ */+ BINARY,+ /**+ * A pre-sorted byte[]. Fields with this type only store distinct byte values+ * and store an additional offset pointer per document to dereference the shared+ * byte[]. The stored byte[] is presorted and allows access via document id,+ * ordinal and by-value. Values must be <= 32766 bytes.+ */+ SORTED,+ /**+ * A pre-sorted Number[]. Fields with this type store numeric values in sorted+ * order according to {@link Long#compare(long, long)}.+ */+ SORTED_NUMERIC,+ /**+ * A pre-sorted Set<byte[]>. Fields with this type only store distinct byte values+ * and store additional offset pointers per document to dereference the shared+ * byte[]s. The stored byte[] is presorted and allows access via document id,+ * ordinal and by-value. Values must be <= 32766 bytes.+ */+ SORTED_SET,+}+diff --git a/lucene/core/src/java/org/apache/lucene/index/DocValuesUpdate.java b/lucene/core/src/java/org/apache/lucene/index/DocValuesUpdate.javaindex 57ba1b60c66..4a259aea32e 100644--- a/lucene/core/src/java/org/apache/lucene/index/DocValuesUpdate.java+++ b/lucene/core/src/java/org/apache/lucene/index/DocValuesUpdate.java@@ -1,15 +1,5 @@package org.apache.lucene.index;-import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_ARRAY_HEADER;-import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_CHAR;-import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_INT;-import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_HEADER;-import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF;--import org.apache.lucene.document.NumericDocValuesField;-import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.RamUsageEstimator;-/** Licensed to the Apache Software Foundation (ASF) under one or more* contributor license agreements. See the NOTICE file distributed with@@ -27,6 +17,16 @@ import org.apache.lucene.util.RamUsageEstimator;* limitations under the License.*/+import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_ARRAY_HEADER;+import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_CHAR;+import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_INT;+import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_HEADER;+import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF;++import org.apache.lucene.document.NumericDocValuesField;+import org.apache.lucene.util.BytesRef;+import org.apache.lucene.util.RamUsageEstimator;+/** An in-place update to a DocValues field. */abstract class DocValuesUpdate {@@ -39,7 +39,7 @@ abstract class DocValuesUpdate {*/private static final int RAW_SIZE_IN_BYTES = 8*NUM_BYTES_OBJECT_HEADER + 8*NUM_BYTES_OBJECT_REF + 8*NUM_BYTES_INT;- final FieldInfo.DocValuesType type;+ final DocValuesType type;final Term term;final String field;final Object value;@@ -52,7 +52,7 @@ abstract class DocValuesUpdate {* @param field the {@link NumericDocValuesField} to update* @param value the updated value*/- protected DocValuesUpdate(FieldInfo.DocValuesType type, Term term, String field, Object value) {+ protected DocValuesUpdate(DocValuesType type, Term term, String field, Object value) {this.type = type;this.term = term;this.field = field;@@ -82,7 +82,7 @@ abstract class DocValuesUpdate {private static final long RAW_VALUE_SIZE_IN_BYTES = NUM_BYTES_ARRAY_HEADER + 2*NUM_BYTES_INT + NUM_BYTES_OBJECT_REF;BinaryDocValuesUpdate(Term term, String field, BytesRef value) {- super(FieldInfo.DocValuesType.BINARY, term, field, value);+ super(DocValuesType.BINARY, term, field, value);}@Override@@ -96,7 +96,7 @@ abstract class DocValuesUpdate {static final class NumericDocValuesUpdate extends DocValuesUpdate {NumericDocValuesUpdate(Term term, String field, Long value) {- super(FieldInfo.DocValuesType.NUMERIC, term, field, value);+ super(DocValuesType.NUMERIC, term, field, value);}@Overridediff --git a/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java b/lucene/core/src/java/org/apache/lucene/index/DocsEnum.javaindex fa4cf54679f..bfc00a30ad9 100644--- a/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java+++ b/lucene/core/src/java/org/apache/lucene/index/DocsEnum.java@@ -19,7 +19,6 @@ package org.apache.lucene.index;import java.io.IOException;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.util.AttributeSource;import org.apache.lucene.util.Bits; // javadocs@@ -50,7 +49,7 @@ public abstract class DocsEnum extends DocIdSetIterator {/*** Returns term frequency in the current document, or 1 if the field was- * indexed with {@link IndexOptions#DOCS_ONLY}. Do not call this before+ * indexed with {@link IndexOptions#DOCS}. Do not call this before* {@link #nextDoc} is first called, nor after {@link #nextDoc} returns* {@link DocIdSetIterator#NO_MORE_DOCS}.*diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.javaindex 9ba54c82f4d..04bfd219884 100644--- a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java+++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java@@ -34,90 +34,19 @@ public final class FieldInfo {/** Internal field number */public final int number;- private DocValuesType docValueType;+ private DocValuesType docValueType = DocValuesType.NO;// True if any document indexed term vectorsprivate boolean storeTermVector;private boolean omitNorms; // omit norms associated with indexed fields- private IndexOptions indexOptions;+ private IndexOptions indexOptions = IndexOptions.NO;private boolean storePayloads; // whether this field stores payloads together with term positionsprivate Map<String,String> attributes;private long dvGen;-- /**- * Controls how much information is stored in the postings lists.- * @lucene.experimental- */- public static enum IndexOptions {- // NOTE: order is important here; FieldInfo uses this- // order to merge two conflicting IndexOptions (always- // "downgrades" by picking the lowest).- /**- * Only documents are indexed: term frequencies and positions are omitted.- * Phrase and other positional queries on the field will throw an exception, and scoring- * will behave as if any term in the document appears only once.- */- // TODO: maybe rename to just DOCS?- DOCS_ONLY,- /**- * Only documents and term frequencies are indexed: positions are omitted.- * This enables normal scoring, except Phrase and other positional queries- * will throw an exception.- */- DOCS_AND_FREQS,- /**- * Indexes documents, frequencies and positions.- * This is a typical default for full-text search: full scoring is enabled- * and positional queries are supported.- */- DOCS_AND_FREQS_AND_POSITIONS,- /**- * Indexes documents, frequencies, positions and offsets.- * Character offsets are encoded alongside the positions.- */- DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,- }-- /**- * DocValues types.- * Note that DocValues is strongly typed, so a field cannot have different types- * across different documents.- */- public static enum DocValuesType {- /**- * A per-document Number- */- NUMERIC,- /**- * A per-document byte[]. Values may be larger than- * 32766 bytes, but different codecs may enforce their own limits.- */- BINARY,- /**- * A pre-sorted byte[]. Fields with this type only store distinct byte values- * and store an additional offset pointer per document to dereference the shared- * byte[]. The stored byte[] is presorted and allows access via document id,- * ordinal and by-value. Values must be <= 32766 bytes.- */- SORTED,- /**- * A pre-sorted Number[]. Fields with this type store numeric values in sorted- * order according to {@link Long#compare(long, long)}.- */- SORTED_NUMERIC,- /**- * A pre-sorted Set<byte[]>. Fields with this type only store distinct byte values- * and store additional offset pointers per document to dereference the shared- * byte[]s. The stored byte[] is presorted and allows access via document id,- * ordinal and by-value. Values must be <= 32766 bytes.- */- SORTED_SET- }-/*** Sole constructor.*@@ -126,19 +55,24 @@ public final class FieldInfo {public FieldInfo(String name, int number, boolean storeTermVector, boolean omitNorms,boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues,long dvGen, Map<String,String> attributes) {+ if (docValues == null) {+ throw new NullPointerException("DocValuesType cannot be null");+ }+ if (indexOptions == null) {+ throw new NullPointerException("IndexOptions cannot be null");+ }this.name = name;this.number = number;this.docValueType = docValues;- if (indexOptions != null) {+ this.indexOptions = indexOptions;+ if (indexOptions != IndexOptions.NO) {this.storeTermVector = storeTermVector;this.storePayloads = storePayloads;this.omitNorms = omitNorms;- this.indexOptions = indexOptions;} else { // for non-indexed fields, leave defaultsthis.storeTermVector = false;this.storePayloads = false;this.omitNorms = false;- this.indexOptions = null;}this.dvGen = dvGen;this.attributes = attributes;@@ -150,7 +84,7 @@ public final class FieldInfo {* Always returns true (or throws IllegalStateException)*/public boolean checkConsistency() {- if (indexOptions != null) {+ if (indexOptions != IndexOptions.NO) {// Cannot store payloads unless positions are indexed:if (indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0 && storePayloads) {throw new IllegalStateException("indexed field '" + name + "' cannot have payloads without positions");@@ -180,26 +114,29 @@ public final class FieldInfo {// should only be called by FieldInfos#addOrUpdatevoid update(boolean storeTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions) {+ if (indexOptions == null) {+ throw new NullPointerException("IndexOptions cannot be null");+ }//System.out.println("FI.update field=" + name + " indexed=" + indexed + " omitNorms=" + omitNorms + " this.omitNorms=" + this.omitNorms);if (this.indexOptions != indexOptions) {- if (this.indexOptions == null) {+ if (this.indexOptions == IndexOptions.NO) {this.indexOptions = indexOptions;- } else if (indexOptions != null) {+ } else if (indexOptions != IndexOptions.NO) {// downgradethis.indexOptions = this.indexOptions.compareTo(indexOptions) < 0 ? this.indexOptions : indexOptions;}}- if (this.indexOptions != null) { // if updated field data is not for indexing, leave the updates out+ if (this.indexOptions != IndexOptions.NO) { // if updated field data is not for indexing, leave the updates outthis.storeTermVector |= storeTermVector; // once vector, always vectorthis.storePayloads |= storePayloads;// Awkward: only drop norms if incoming update is indexed:- if (indexOptions != null && this.omitNorms != omitNorms) {+ if (indexOptions != IndexOptions.NO && this.omitNorms != omitNorms) {this.omitNorms = true; // if one require omitNorms at least once, it remains off for life}}- if (this.indexOptions == null || this.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0) {+ if (this.indexOptions == IndexOptions.NO || this.indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0) {// cannot store payloads if we don't store positions:this.storePayloads = false;}@@ -207,14 +144,14 @@ public final class FieldInfo {}void setDocValuesType(DocValuesType type) {- if (docValueType != null && docValueType != type) {+ if (docValueType != DocValuesType.NO && docValueType != type) {throw new IllegalArgumentException("cannot change DocValues type from " + docValueType + " to " + type + " for field \"" + name + "\"");}docValueType = type;assert checkConsistency();}- /** Returns IndexOptions for the field, or null if the field is not indexed */+ /** Returns IndexOptions for the field, or IndexOptions.NO if the field is not indexed */public IndexOptions getIndexOptions() {return indexOptions;}@@ -223,11 +160,12 @@ public final class FieldInfo {* Returns true if this field has any docValues.*/public boolean hasDocValues() {- return docValueType != null;+ return docValueType != DocValuesType.NO;}/**- * Returns {@link DocValuesType} of the docValues. this may be null if the field has no docvalues.+ * Returns {@link DocValuesType} of the docValues; this is+ * {@code DocValuesType.NO} if the field has no docvalues.*/public DocValuesType getDocValuesType() {return docValueType;@@ -253,7 +191,7 @@ public final class FieldInfo {}void setStorePayloads() {- if (indexOptions != null && indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) {+ if (indexOptions != IndexOptions.NO && indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) {storePayloads = true;}assert checkConsistency();@@ -274,10 +212,10 @@ public final class FieldInfo {}/**- * Returns true if this field is indexed (has non-null {@link #getIndexOptions}).+ * Returns true if this field is indexed ({@link #getIndexOptions} is not IndexOptions.NO).*/public boolean isIndexed() {- return indexOptions != null;+ return indexOptions != IndexOptions.NO;}/**diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.javaindex 8c01184cd1f..4476ea53d9e 100644--- a/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java+++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfos.java@@ -25,9 +25,6 @@ import java.util.Map;import java.util.SortedMap;import java.util.TreeMap;-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;-/*** Collection of {@link FieldInfo}s (accessible by number or by name).* @lucene.experimental@@ -72,7 +69,7 @@ public class FieldInfos implements Iterable<FieldInfo> {hasVectors |= info.hasVectors();hasProx |= info.isIndexed() && info.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;- hasFreq |= info.isIndexed() && info.getIndexOptions() != IndexOptions.DOCS_ONLY;+ hasFreq |= info.isIndexed() && info.getIndexOptions() != IndexOptions.DOCS;hasOffsets |= info.isIndexed() && info.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;hasNorms |= info.hasNorms();hasDocValues |= info.hasDocValues();@@ -190,18 +187,17 @@ public class FieldInfos implements Iterable<FieldInfo> {* is used as the field number.*/synchronized int addOrGet(String fieldName, int preferredFieldNumber, DocValuesType dvType) {- if (dvType != null) {+ if (dvType != DocValuesType.NO) {DocValuesType currentDVType = docValuesType.get(fieldName);if (currentDVType == null) {docValuesType.put(fieldName, dvType);- } else if (currentDVType != null && currentDVType != dvType) {+ } else if (currentDVType != DocValuesType.NO && currentDVType != dvType) {throw new IllegalArgumentException("cannot change DocValues type from " + currentDVType + " to " + dvType + " for field \"" + fieldName + "\"");}}Integer fieldNumber = nameToNumber.get(fieldName);if (fieldNumber == null) {final Integer preferredBoxed = Integer.valueOf(preferredFieldNumber);-if (preferredFieldNumber != -1 && !numberToName.containsKey(preferredBoxed)) {// cool - we can use this number globallyfieldNumber = preferredBoxed;@@ -212,7 +208,7 @@ public class FieldInfos implements Iterable<FieldInfo> {}fieldNumber = lowestUnassignedFieldNumber;}-+ assert fieldNumber >= 0;numberToName.put(fieldNumber, fieldName);nameToNumber.put(fieldName, fieldNumber);}@@ -228,7 +224,7 @@ public class FieldInfos implements Iterable<FieldInfo> {throw new IllegalArgumentException("field name \"" + name + "\" is already mapped to field number \"" + nameToNumber.get(name) + "\", not \"" + number + "\"");}DocValuesType currentDVType = docValuesType.get(name);- if (dvType != null && currentDVType != null && dvType != currentDVType) {+ if (dvType != DocValuesType.NO && currentDVType != null && currentDVType != DocValuesType.NO && dvType != currentDVType) {throw new IllegalArgumentException("cannot change DocValues type from " + currentDVType + " to " + dvType + " for field \"" + name + "\"");}}@@ -298,6 +294,9 @@ public class FieldInfos implements Iterable<FieldInfo> {private FieldInfo addOrUpdateInternal(String name, int preferredFieldNumber,boolean storeTermVector,boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValuesType docValues) {+ if (docValues == null) {+ throw new NullPointerException("DocValuesType cannot be null");+ }FieldInfo fi = fieldInfo(name);if (fi == null) {// This field wasn't yet added to this in-RAM@@ -313,7 +312,7 @@ public class FieldInfos implements Iterable<FieldInfo> {} else {fi.update(storeTermVector, omitNorms, storePayloads, indexOptions);- if (docValues != null) {+ if (docValues != DocValuesType.NO) {// Only pay the synchronization cost if fi does not already have a DVTypeboolean updateGlobal = !fi.hasDocValues();if (updateGlobal) {diff --git a/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java b/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.javaindex 5d017540fbd..fe5d31f8f0a 100644--- a/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java+++ b/lucene/core/src/java/org/apache/lucene/index/FreqProxFields.java@@ -23,7 +23,6 @@ import java.util.LinkedHashMap;import java.util.List;import java.util.Map;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FreqProxTermsWriterPerField.FreqProxPostingsArray;import org.apache.lucene.util.AttributeSource; // javadocsimport org.apache.lucene.util.Bits;diff --git a/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java b/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.javaindex a45e62a05f7..5abe281d5d4 100644--- a/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java+++ b/lucene/core/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java@@ -21,7 +21,6 @@ import java.io.IOException;import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.RamUsageEstimator;@@ -50,7 +49,7 @@ final class FreqProxTermsWriterPerField extends TermsHashPerField {public FreqProxTermsWriterPerField(FieldInvertState invertState, TermsHash termsHash, FieldInfo fieldInfo, TermsHashPerField nextPerField) {super(fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 ? 2 : 1, invertState, termsHash, nextPerField, fieldInfo);IndexOptions indexOptions = fieldInfo.getIndexOptions();- assert indexOptions != null;+ assert indexOptions != IndexOptions.NO;hasFreq = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;hasProx = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;hasOffsets = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;@@ -196,7 +195,7 @@ final class FreqProxTermsWriterPerField extends TermsHashPerField {@OverrideParallelPostingsArray createPostingsArray(int size) {IndexOptions indexOptions = fieldInfo.getIndexOptions();- assert indexOptions != null;+ assert indexOptions != IndexOptions.NO;boolean hasFreq = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;boolean hasProx = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;boolean hasOffsets = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexOptions.java b/lucene/core/src/java/org/apache/lucene/index/IndexOptions.javanew file mode 100644index 00000000000..992955d6075--- /dev/null+++ b/lucene/core/src/java/org/apache/lucene/index/IndexOptions.java@@ -0,0 +1,55 @@+package org.apache.lucene.index;++/*+ * Licensed to the Apache Software Foundation (ASF) under one or more+ * contributor license agreements. See the NOTICE file distributed with+ * this work for additional information regarding copyright ownership.+ * The ASF licenses this file to You under the Apache License, Version 2.0+ * (the "License"); you may not use this file except in compliance with+ * the License. You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++/**+ * Controls how much information is stored in the postings lists.+ * @lucene.experimental+ */++public enum IndexOptions {+ // NOTE: order is important here; FieldInfo uses this+ // order to merge two conflicting IndexOptions (always+ // "downgrades" by picking the lowest).+ /** Not indexed */+ NO,+ /**+ * Only documents are indexed: term frequencies and positions are omitted.+ * Phrase and other positional queries on the field will throw an exception, and scoring+ * will behave as if any term in the document appears only once.+ */+ DOCS,+ /**+ * Only documents and term frequencies are indexed: positions are omitted.+ * This enables normal scoring, except Phrase and other positional queries+ * will throw an exception.+ */+ DOCS_AND_FREQS,+ /**+ * Indexes documents, frequencies and positions.+ * This is a typical default for full-text search: full scoring is enabled+ * and positional queries are supported.+ */+ DOCS_AND_FREQS_AND_POSITIONS,+ /**+ * Indexes documents, frequencies, positions and offsets.+ * Character offsets are encoded alongside the positions.+ */+ DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,+}+diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.javaindex c9c5a372152..449b737a8c8 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java@@ -45,7 +45,6 @@ import org.apache.lucene.codecs.FieldInfosFormat;import org.apache.lucene.document.Field;import org.apache.lucene.index.DocValuesUpdate.BinaryDocValuesUpdate;import org.apache.lucene.index.DocValuesUpdate.NumericDocValuesUpdate;-import org.apache.lucene.index.FieldInfo.DocValuesType;import org.apache.lucene.index.FieldInfos.FieldNumbers;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.index.MergeState.CheckAbort;@@ -1499,6 +1498,9 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {final Field f = updates[i];final DocValuesType dvType = f.fieldType().docValueType();if (dvType == null) {+ throw new NullPointerException("DocValuesType cannot be null (field: \"" + f.name() + "\")");+ }+ if (dvType == DocValuesType.NO) {throw new IllegalArgumentException("can only update NUMERIC or BINARY fields! field=" + f.name());}if (!globalFieldNumberMap.contains(f.name(), dvType)) {diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexableField.java b/lucene/core/src/java/org/apache/lucene/index/IndexableField.javaindex 74dbe31c3a7..3fd7ba53d36 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexableField.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexableField.java@@ -64,8 +64,8 @@ public interface IndexableField extends GeneralField {* the range of that encoding.* <p>* It is illegal to return a boost other than 1.0f for a field that is not- * indexed ({@link IndexableFieldType#indexOptions()} is null) or omits normalization values- * ({@link IndexableFieldType#omitNorms()} returns true).+ * indexed ({@link IndexableFieldType#indexOptions()} is IndexOptions.NO) or+ * omits normalization values ({@link IndexableFieldType#omitNorms()} returns true).** @see Similarity#computeNorm(FieldInvertState)* @see DefaultSimilarity#encodeNormValue(float)diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.java b/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.javaindex 449ec74bfba..f86d691cbe3 100644--- a/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.java+++ b/lucene/core/src/java/org/apache/lucene/index/IndexableFieldType.java@@ -18,8 +18,6 @@ package org.apache.lucene.index;*/import org.apache.lucene.analysis.Analyzer; // javadocs-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;/*** Describes the properties of a field.@@ -34,7 +32,8 @@ public interface IndexableFieldType {* True if this field's value should be analyzed by the* {@link Analyzer}.* <p>- * This has no effect if {@link #indexOptions()} returns null.+ * This has no effect if {@link #indexOptions()} returns+ * IndexOptions.NO.*/// TODO: shouldn't we remove this? Whether/how a field is// tokenized is an impl detail under Field?@@ -48,7 +47,8 @@ public interface IndexableFieldType {* can be accessed in a document-oriented way from* {@link IndexReader#getTermVector(int,String)}.* <p>- * This option is illegal if {@link #indexOptions()} returns null.+ * This option is illegal if {@link #indexOptions()} returns+ * IndexOptions.NO.*/public boolean storeTermVectors();@@ -88,13 +88,12 @@ public interface IndexableFieldType {public boolean omitNorms();/** {@link IndexOptions}, describing what should be- * recorded into the inverted index, or null if this field- * is not indexed */+ * recorded into the inverted index */public IndexOptions indexOptions();/**- * DocValues {@link DocValuesType}: if non-null then the field's value- * will be indexed into docValues.+ * DocValues {@link DocValuesType}: how the field's value will be indexed+ * into docValues.*/public DocValuesType docValueType();}diff --git a/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java b/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.javaindex 583b8592864..dd6e8599317 100644--- a/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java+++ b/lucene/core/src/java/org/apache/lucene/index/NumericDocValuesFieldUpdates.java@@ -86,7 +86,7 @@ class NumericDocValuesFieldUpdates extends DocValuesFieldUpdates {private int size;public NumericDocValuesFieldUpdates(String field, int maxDoc) {- super(field, FieldInfo.DocValuesType.NUMERIC);+ super(field, DocValuesType.NUMERIC);bitsPerValue = PackedInts.bitsRequired(maxDoc - 1);docs = new PagedMutable(1, PAGE_SIZE, bitsPerValue, PackedInts.COMPACT);values = new PagedGrowableWriter(1, PAGE_SIZE, 1, PackedInts.FAST);diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java b/lucene/core/src/java/org/apache/lucene/index/SegmentReader.javaindex a7850164cb0..c7f39ef34b6 100644--- a/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentReader.java@@ -32,7 +32,6 @@ import org.apache.lucene.codecs.FieldsProducer;import org.apache.lucene.codecs.NormsProducer;import org.apache.lucene.codecs.StoredFieldsReader;import org.apache.lucene.codecs.TermVectorsReader;-import org.apache.lucene.index.FieldInfo.DocValuesType;import org.apache.lucene.store.Directory;import org.apache.lucene.store.IOContext;import org.apache.lucene.util.Accountable;@@ -340,7 +339,7 @@ public final class SegmentReader extends LeafReader implements Accountable {// Field does not existreturn null;}- if (fi.getDocValuesType() == null) {+ if (fi.getDocValuesType() == DocValuesType.NO) {// Field was not indexed with doc valuesreturn null;}@@ -385,7 +384,7 @@ public final class SegmentReader extends LeafReader implements Accountable {// Field does not existreturn null;}- if (fi.getDocValuesType() == null) {+ if (fi.getDocValuesType() == DocValuesType.NO) {// Field was not indexed with doc valuesreturn null;}diff --git a/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java b/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.javaindex 074701f90e7..e61f4f45ff6 100644--- a/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java+++ b/lucene/core/src/java/org/apache/lucene/index/SlowCompositeReaderWrapper.java@@ -23,7 +23,6 @@ import java.util.Map;import org.apache.lucene.util.Bits;-import org.apache.lucene.index.FieldInfo.DocValuesType;import org.apache.lucene.index.MultiDocValues.MultiSortedDocValues;import org.apache.lucene.index.MultiDocValues.MultiSortedSetDocValues;import org.apache.lucene.index.MultiDocValues.OrdinalMap;diff --git a/lucene/core/src/java/org/apache/lucene/index/TermVectorsConsumerPerField.java b/lucene/core/src/java/org/apache/lucene/index/TermVectorsConsumerPerField.javaindex ccebf1b5259..68b28b234de 100644--- a/lucene/core/src/java/org/apache/lucene/index/TermVectorsConsumerPerField.java+++ b/lucene/core/src/java/org/apache/lucene/index/TermVectorsConsumerPerField.java@@ -111,7 +111,7 @@ final class TermVectorsConsumerPerField extends TermsHashPerField {@Overrideboolean start(IndexableField field, boolean first) {- assert field.fieldType().indexOptions() != null;+ assert field.fieldType().indexOptions() != IndexOptions.NO;if (first) {diff --git a/lucene/core/src/java/org/apache/lucene/index/package.html b/lucene/core/src/java/org/apache/lucene/index/package.htmlindex 414637a32a5..7458734d710 100644--- a/lucene/core/src/java/org/apache/lucene/index/package.html+++ b/lucene/core/src/java/org/apache/lucene/index/package.html@@ -161,7 +161,7 @@ while ((docid = docsAndPositionsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCSof occurrences of this term across all documents. Note that this statisticis unavailable (returns <code>-1</code>) if term frequencies were omittedfrom the index- ({@link org.apache.lucene.index.FieldInfo.IndexOptions#DOCS_ONLY DOCS_ONLY})+ ({@link org.apache.lucene.index.IndexOptions#DOCS DOCS})for the field. Like docFreq(), it will also count occurrences that appear indeleted documents.</ul>@@ -194,7 +194,7 @@ while ((docid = docsAndPositionsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCSfield, and like totalTermFreq() it will also count occurrences that appear indeleted documents, and will be unavailable (returns <code>-1</code>) if termfrequencies were omitted from the index- ({@link org.apache.lucene.index.FieldInfo.IndexOptions#DOCS_ONLY DOCS_ONLY})+ ({@link org.apache.lucene.index.IndexOptions#DOCS DOCS})for the field.</ul></p>diff --git a/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java b/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.javaindex ddd63432c84..76b471b3514 100644--- a/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java+++ b/lucene/core/src/test/org/apache/lucene/analysis/TestMockAnalyzer.java@@ -25,19 +25,19 @@ import java.util.Random;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;-import org.apache.lucene.index.LeafReader;import org.apache.lucene.index.DocsAndPositionsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.Fields;+import org.apache.lucene.index.IndexOptions;+import org.apache.lucene.index.LeafReader;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.TestUtil;-import org.apache.lucene.util.automaton.AutomatonTestUtil;import org.apache.lucene.util.automaton.Automata;-import org.apache.lucene.util.automaton.Operations;+import org.apache.lucene.util.automaton.AutomatonTestUtil;import org.apache.lucene.util.automaton.CharacterRunAutomaton;+import org.apache.lucene.util.automaton.Operations;import org.apache.lucene.util.automaton.RegExp;public class TestMockAnalyzer extends BaseTokenStreamTestCase {@@ -305,7 +305,7 @@ public class TestMockAnalyzer extends BaseTokenStreamTestCase {final RandomIndexWriter writer = new RandomIndexWriter(random(), newDirectory());final Document doc = new Document();final FieldType ft = new FieldType();- ft.setIndexOptions(IndexOptions.DOCS_ONLY);+ ft.setIndexOptions(IndexOptions.DOCS);ft.setTokenized(true);ft.setStoreTermVectors(true);ft.setStoreTermVectorPositions(true);diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat2.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat2.javaindex ac29c25f8d3..a8096affc57 100644--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat2.java+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat2.java@@ -22,8 +22,7 @@ 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.FieldInfo.IndexOptions;-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.index.IndexWriterConfig;@@ -66,7 +65,10 @@ public class TestBlockPostingsFormat2 extends LuceneTestCase {private Document newDocument() {Document doc = new Document();- for (IndexOptions option : FieldInfo.IndexOptions.values()) {+ for (IndexOptions option : IndexOptions.values()) {+ if (option == IndexOptions.NO) {+ continue;+ }FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);// turn on tvs for a cross-check, since we rely upon checkindex in this test (for now)ft.setStoreTermVectors(true);diff --git a/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat3.java b/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat3.javaindex 1e209138dc1..fb058036c28 100644--- a/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat3.java+++ b/lucene/core/src/test/org/apache/lucene/codecs/lucene50/TestBlockPostingsFormat3.java@@ -32,18 +32,18 @@ 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.LeafReader;-import org.apache.lucene.index.LeafReaderContext;-import org.apache.lucene.index.FieldInfo.IndexOptions;-import org.apache.lucene.index.IndexWriterConfig.OpenMode;-import org.apache.lucene.index.TermsEnum.SeekStatus;import org.apache.lucene.index.DirectoryReader;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexWriter;+import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.index.IndexWriterConfig;+import org.apache.lucene.index.LeafReader;+import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.Terms;+import org.apache.lucene.index.TermsEnum.SeekStatus;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.store.Directory;@@ -90,7 +90,7 @@ public class TestBlockPostingsFormat3 extends LuceneTestCase {FieldType docsOnlyType = new FieldType(TextField.TYPE_NOT_STORED);// turn this on for a cross-checkdocsOnlyType.setStoreTermVectors(true);- docsOnlyType.setIndexOptions(IndexOptions.DOCS_ONLY);+ docsOnlyType.setIndexOptions(IndexOptions.DOCS);FieldType docsAndFreqsType = new FieldType(TextField.TYPE_NOT_STORED);// turn this on for a cross-checkdiff --git a/lucene/core/src/test/org/apache/lucene/document/TestDocument.java b/lucene/core/src/test/org/apache/lucene/document/TestDocument.javaindex b176d409291..581d76fca93 100644--- a/lucene/core/src/test/org/apache/lucene/document/TestDocument.java+++ b/lucene/core/src/test/org/apache/lucene/document/TestDocument.java@@ -25,7 +25,7 @@ import java.util.List;import org.apache.lucene.analysis.MockTokenizer;import org.apache.lucene.analysis.Tokenizer;import org.apache.lucene.index.DirectoryReader;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.StorableField;@@ -65,7 +65,7 @@ public class TestDocument extends LuceneTestCase {assertTrue(binaryFld.binaryValue() != null);assertTrue(binaryFld.fieldType().stored());- assertNull(binaryFld.fieldType().indexOptions());+ assertEquals(IndexOptions.NO, binaryFld.fieldType().indexOptions());String binaryTest = doc.getBinaryValue("binary").utf8ToString();assertTrue(binaryTest.equals(binaryVal));diff --git a/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java b/lucene/core/src/test/org/apache/lucene/document/TestFieldType.javaindex 249ed040ee2..2dcb54487bb 100644--- a/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java+++ b/lucene/core/src/test/org/apache/lucene/document/TestFieldType.java@@ -18,8 +18,8 @@ package org.apache.lucene.document;*/import org.apache.lucene.document.FieldType.NumericType;-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.DocValuesType;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.util.LuceneTestCase;/** simple testcases for concrete impl of IndexableFieldType */diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java b/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.javaindex 3152893524c..2617f0ffc3d 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BPostings.java@@ -24,13 +24,11 @@ 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.FieldInfo.IndexOptions;import org.apache.lucene.store.BaseDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper;-import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.TimeUnits;-import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;/**@@ -66,7 +64,7 @@ public class Test2BPostings extends LuceneTestCase {Document doc = new Document();FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);ft.setOmitNorms(true);- ft.setIndexOptions(IndexOptions.DOCS_ONLY);+ ft.setIndexOptions(IndexOptions.DOCS);Field field = new Field("field", new MyTokenStream(), ft);doc.add(field);diff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java b/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.javaindex 7252c16bb17..fa41731a2ff 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BPostingsBytes.java@@ -26,17 +26,13 @@ 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.FieldInfo.IndexOptions;import org.apache.lucene.store.BaseDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.TestUtil;-import org.apache.lucene.util.TimeUnits;import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;-import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite;-/*** Test indexes 2B docs with 65k freqs each,* so you get > Integer.MAX_VALUE postings data for the termdiff --git a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.javaindex a0a84dfd4cd..dfa0e01a881 100644--- a/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java+++ b/lucene/core/src/test/org/apache/lucene/index/Test2BTerms.java@@ -31,7 +31,6 @@ 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.FieldInfo.IndexOptions;import org.apache.lucene.search.IndexSearcher;import org.apache.lucene.search.TermQuery;import org.apache.lucene.store.BaseDirectoryWrapper;@@ -42,7 +41,6 @@ import org.apache.lucene.util.AttributeImpl;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.LuceneTestCase.Monster;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;-import org.apache.lucene.util.LuceneTestCase.SuppressSysoutChecks;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.TimeUnits;@@ -197,7 +195,7 @@ public class Test2BTerms extends LuceneTestCase {final MyTokenStream ts = new MyTokenStream(random(), TERMS_PER_DOC);FieldType customType = new FieldType(TextField.TYPE_NOT_STORED);- customType.setIndexOptions(IndexOptions.DOCS_ONLY);+ customType.setIndexOptions(IndexOptions.DOCS);customType.setOmitNorms(true);Field field = new Field("field", ts, customType);doc.add(field);diff --git a/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java b/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.javaindex e4bdd17833d..5c517970617 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java@@ -34,7 +34,6 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.PhraseQuery;diff --git a/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java b/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.javaindex c919f965721..5c6424fd724 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestBagOfPositions.java@@ -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.FieldType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;diff --git a/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java b/lucene/core/src/test/org/apache/lucene/index/TestCodecs.javaindex d241b17b6cb..5eeefae2174 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestCodecs.java@@ -30,8 +30,6 @@ import org.apache.lucene.codecs.FieldsProducer;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field.Store;import org.apache.lucene.document.StringField;-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.IndexSearcher;import org.apache.lucene.search.Query;@@ -114,10 +112,10 @@ public class TestCodecs extends LuceneTestCase {public boolean omitNorms() { return false; }@Override- public IndexOptions indexOptions() { return omitTF ? IndexOptions.DOCS_ONLY : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }+ public IndexOptions indexOptions() { return omitTF ? IndexOptions.DOCS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }@Override- public DocValuesType docValueType() { return null; }+ public DocValuesType docValueType() { return DocValuesType.NO; }});if (storePayloads) {fieldInfo.setStorePayloads();diff --git a/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.javaindex 991b676914c..729ef6b0d8f 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestDocumentWriter.java@@ -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.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.store.Directory;import org.apache.lucene.util.AttributeSource;@@ -274,7 +273,7 @@ public class TestDocumentWriter extends LuceneTestCase {doc.add(newField("f1", "v2", customType2));// f2 has no TFFieldType customType3 = new FieldType(TextField.TYPE_NOT_STORED);- customType3.setIndexOptions(IndexOptions.DOCS_ONLY);+ customType3.setIndexOptions(IndexOptions.DOCS);Field f = newField("f2", "v1", customType3);doc.add(f);doc.add(newField("f2", "v2", customType2));@@ -293,7 +292,7 @@ public class TestDocumentWriter extends LuceneTestCase {assertEquals("omitTermFreqAndPositions field bit should not be set for f1", IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, fi.fieldInfo("f1").getIndexOptions());// f2assertTrue("f2 should have norms", fi.fieldInfo("f2").hasNorms());- assertEquals("omitTermFreqAndPositions field bit should be set for f2", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());+ assertEquals("omitTermFreqAndPositions field bit should be set for f2", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());reader.close();}}diff --git a/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.java b/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.javaindex c2d63156950..256b66510ff 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestExceedMaxTermLength.java@@ -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.FieldType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.store.Directory;import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.TestUtil;diff --git a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.javaindex fd62a4639bd..f22a710eb57 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java@@ -17,7 +17,6 @@ package org.apache.lucene.index;* limitations under the License.*/-import java.io.File;import java.io.IOException;import java.nio.file.Path;import java.util.*;@@ -27,7 +26,6 @@ import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.document.Document;import org.apache.lucene.document.DocumentStoredFieldVisitor;import org.apache.lucene.document.Field;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.store.BaseDirectory;import org.apache.lucene.store.BufferedIndexInput;@@ -96,7 +94,7 @@ public class TestFieldsReader extends LuceneTestCase {assertTrue(field != null);assertFalse(field.fieldType().storeTermVectors());assertFalse(field.fieldType().omitNorms());- assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_ONLY);+ assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS);DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(DocHelper.TEXT_FIELD_3_KEY);reader.document(0, visitor);diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.javaindex 3581dca4599..a03d4dbaecb 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java@@ -54,7 +54,6 @@ import org.apache.lucene.document.SortedSetDocValuesField;import org.apache.lucene.document.StoredField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.IndexSearcher;@@ -1247,7 +1246,7 @@ public class TestIndexWriter extends LuceneTestCase {Field f = new Field("binary", b, 10, 17, customType);// TODO: this is evil, changing the type after creating the field:- customType.setIndexOptions(IndexOptions.DOCS_ONLY);+ customType.setIndexOptions(IndexOptions.DOCS);final MockTokenizer doc1field1 = new MockTokenizer(MockTokenizer.WHITESPACE, false);doc1field1.setReader(new StringReader("doc1field1"));f.setTokenStream(doc1field1);@@ -1807,7 +1806,7 @@ public class TestIndexWriter extends LuceneTestCase {docsAndFreqs.setIndexOptions(IndexOptions.DOCS_AND_FREQS);FieldType docsOnly = new FieldType(TextField.TYPE_NOT_STORED);- docsOnly.setIndexOptions(IndexOptions.DOCS_ONLY);+ docsOnly.setIndexOptions(IndexOptions.DOCS);Document doc = new Document();doc.add(new Field("field", "a b c", docsAndFreqs));diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.javaindex 779fe430c7a..30917ae46a2 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java@@ -48,7 +48,6 @@ import org.apache.lucene.document.SortedSetDocValuesField;import org.apache.lucene.document.StoredField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.IndexSearcher;import org.apache.lucene.search.PhraseQuery;@@ -58,8 +57,8 @@ import org.apache.lucene.store.Directory;import org.apache.lucene.store.IOContext;import org.apache.lucene.store.IndexInput;import org.apache.lucene.store.IndexOutput;-import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper.FakeIOException;+import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.store.RAMDirectory;import org.apache.lucene.util.Bits;import org.apache.lucene.util.BytesRef;diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.javaindex a9ec0f53b70..207b170aba2 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterNRTIsCurrent.java@@ -190,7 +190,6 @@ public class TestIndexWriterNRTIsCurrent extends LuceneTestCase {if (failed == null) {failed = e;}- return;}}}diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.javaindex f4020ab7d62..76be7b23099 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexableField.java@@ -28,7 +28,6 @@ import org.apache.lucene.analysis.TokenStream;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.StoredField;-import org.apache.lucene.index.FieldInfo.DocValuesType;import org.apache.lucene.search.BooleanClause;import org.apache.lucene.search.BooleanQuery;import org.apache.lucene.search.DocIdSetIterator;@@ -58,7 +57,7 @@ public class TestIndexableField extends LuceneTestCase {@Overridepublic boolean storeTermVectors() {- return indexOptions() != null && counter % 2 == 1 && counter % 10 != 9;+ return indexOptions() != IndexOptions.NO && counter % 2 == 1 && counter % 10 != 9;}@Override@@ -82,13 +81,13 @@ public class TestIndexableField extends LuceneTestCase {}@Override- public FieldInfo.IndexOptions indexOptions() {- return counter%10 == 3 ? null : FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;+ public IndexOptions indexOptions() {+ return counter%10 == 3 ? IndexOptions.NO : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;}@Overridepublic DocValuesType docValueType() {- return null;+ return DocValuesType.NO;}};@@ -203,7 +202,7 @@ public class TestIndexableField extends LuceneTestCase {next = new MyField(finalBaseCount + (fieldUpto++-1));}- if (next != null && next.fieldType().indexOptions() != null) return true;+ if (next != null && next.fieldType().indexOptions() != IndexOptions.NO) return true;else return this.hasNext();}diff --git a/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java b/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.javaindex 7731c577dba..0212f66d41c 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java@@ -18,6 +18,7 @@ package org.apache.lucene.index;*/import java.io.IOException;+import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.analysis.TokenStream;@@ -25,14 +26,13 @@ import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.document.TextField;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.LuceneTestCase;-import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;import org.apache.lucene.util.FixedBitSet;+import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;+import org.apache.lucene.util.LuceneTestCase;import org.apache.lucene.util.TestUtil;@SuppressCodecs({ "SimpleText", "Memory", "Direct" })@@ -267,7 +267,7 @@ public class TestLongPostings extends LuceneTestCase {// a weaker form of testLongPostings, that doesnt check positionspublic void testLongPostingsNoPositions() throws Exception {- doTestLongPostingsNoPositions(IndexOptions.DOCS_ONLY);+ doTestLongPostingsNoPositions(IndexOptions.DOCS);doTestLongPostingsNoPositions(IndexOptions.DOCS_AND_FREQS);}@@ -373,7 +373,7 @@ public class TestLongPostings extends LuceneTestCase {final DocsEnum docs;final DocsEnum postings;- if (options == IndexOptions.DOCS_ONLY) {+ if (options == IndexOptions.DOCS) {docs = TestUtil.docs(random(), r, "field", new BytesRef(term), null, null, DocsEnum.FLAG_NONE);postings = null;} else {diff --git a/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.java b/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.javaindex d5cf1b3fb05..fb58903faa7 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestOmitPositions.java@@ -23,7 +23,6 @@ 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.FieldInfo.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.store.Directory;import org.apache.lucene.store.MockDirectoryWrapper;@@ -73,7 +72,7 @@ public class TestOmitPositions extends LuceneTestCase {// f1,f2,f3: docs onlyFieldType ft = new FieldType(TextField.TYPE_NOT_STORED);- ft.setIndexOptions(IndexOptions.DOCS_ONLY);+ ft.setIndexOptions(IndexOptions.DOCS);Field f1 = newField("f1", "This field has docs only", ft);d.add(f1);@@ -157,19 +156,19 @@ public class TestOmitPositions extends LuceneTestCase {SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));FieldInfos fi = reader.getFieldInfos();// docs + docs = docs- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f1").getIndexOptions());+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f1").getIndexOptions());// docs + docs/freqs = docs- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());// docs + docs/freqs/pos = docs- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f3").getIndexOptions());+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f3").getIndexOptions());// docs/freqs + docs = docs- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f4").getIndexOptions());+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f4").getIndexOptions());// docs/freqs + docs/freqs = docs/freqsassertEquals(IndexOptions.DOCS_AND_FREQS, fi.fieldInfo("f5").getIndexOptions());// docs/freqs + docs/freqs/pos = docs/freqsassertEquals(IndexOptions.DOCS_AND_FREQS, fi.fieldInfo("f6").getIndexOptions());// docs/freqs/pos + docs = docs- assertEquals(IndexOptions.DOCS_ONLY, fi.fieldInfo("f7").getIndexOptions());+ assertEquals(IndexOptions.DOCS, fi.fieldInfo("f7").getIndexOptions());// docs/freqs/pos + docs/freqs = docs/freqsassertEquals(IndexOptions.DOCS_AND_FREQS, fi.fieldInfo("f8").getIndexOptions());// docs/freqs/pos + docs/freqs/pos = docs/freqs/posdiff --git a/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java b/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.javaindex 666f471b229..445194dc1c3 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestOmitTf.java@@ -25,7 +25,6 @@ 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.FieldInfo.IndexOptions;import org.apache.lucene.search.BooleanClause.Occur;import org.apache.lucene.search.BooleanQuery;import org.apache.lucene.search.CollectionStatistics;@@ -66,7 +65,7 @@ public class TestOmitTf extends LuceneTestCase {private static final FieldType normalType = new FieldType(TextField.TYPE_NOT_STORED);static {- omitType.setIndexOptions(IndexOptions.DOCS_ONLY);+ omitType.setIndexOptions(IndexOptions.DOCS);}// Tests whether the DocumentWriter correctly enable the@@ -107,8 +106,8 @@ public class TestOmitTf extends LuceneTestCase {SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));FieldInfos fi = reader.getFieldInfos();- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f1").getIndexOptions());- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f1").getIndexOptions());+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());reader.close();ram.close();@@ -159,8 +158,8 @@ public class TestOmitTf extends LuceneTestCase {SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));FieldInfos fi = reader.getFieldInfos();- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f1").getIndexOptions());- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f1").getIndexOptions());+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());reader.close();ram.close();@@ -203,7 +202,7 @@ public class TestOmitTf extends LuceneTestCase {SegmentReader reader = getOnlySegmentReader(DirectoryReader.open(ram));FieldInfos fi = reader.getFieldInfos();assertEquals("OmitTermFreqAndPositions field bit should not be set.", IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, fi.fieldInfo("f1").getIndexOptions());- assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS_ONLY, fi.fieldInfo("f2").getIndexOptions());+ assertEquals("OmitTermFreqAndPositions field bit should be set.", IndexOptions.DOCS, fi.fieldInfo("f2").getIndexOptions());reader.close();ram.close();@@ -451,7 +450,7 @@ public class TestOmitTf extends LuceneTestCase {newIndexWriterConfig(new MockAnalyzer(random())));Document doc = new Document();FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);- ft.setIndexOptions(IndexOptions.DOCS_ONLY);+ ft.setIndexOptions(IndexOptions.DOCS);ft.freeze();Field f = newField("foo", "bar", ft);doc.add(f);diff --git a/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java b/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.javaindex b1add9fd69e..f7eac407584 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestPostingsOffsets.java@@ -37,7 +37,6 @@ import org.apache.lucene.document.IntField;import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.store.Directory;import org.apache.lucene.util.BytesRef;@@ -65,7 +64,7 @@ public class TestPostingsOffsets extends LuceneTestCase {Document doc = new Document();FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);if (random().nextBoolean()) {ft.setStoreTermVectors(true);ft.setStoreTermVectorPositions(random().nextBoolean());@@ -133,7 +132,7 @@ public class TestPostingsOffsets extends LuceneTestCase {RandomIndexWriter w = new RandomIndexWriter(random(), dir, iwc);FieldType ft = new FieldType(TextField.TYPE_STORED);- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);if (random().nextBoolean()) {ft.setStoreTermVectors(true);ft.setStoreTermVectorOffsets(random().nextBoolean());@@ -231,7 +230,7 @@ public class TestPostingsOffsets extends LuceneTestCase {// TODO: randomize what IndexOptions we use; also test// changing this up in one IW buffered segment...:- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);if (random().nextBoolean()) {ft.setStoreTermVectors(true);ft.setStoreTermVectorOffsets(random().nextBoolean());diff --git a/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java b/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.javaindex 0d6fa4f30fd..857b5eb4feb 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestSegmentReader.java@@ -176,7 +176,7 @@ public class TestSegmentReader extends LuceneTestCase {// test omit normsfor (int i=0; i<DocHelper.fields.length; i++) {IndexableField f = DocHelper.fields[i];- if (f.fieldType().indexOptions() != null) {+ if (f.fieldType().indexOptions() != IndexOptions.NO) {assertEquals(reader.getNormValues(f.name()) != null, !f.fieldType().omitNorms());assertEquals(reader.getNormValues(f.name()) != null, !DocHelper.noNorms.containsKey(f.name()));if (reader.getNormValues(f.name()) == null) {diff --git a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.javaindex 3cd7b2961b1..596eae0ba0d 100644--- a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java+++ b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing2.java@@ -31,7 +31,6 @@ 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.FieldInfo.IndexOptions;import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.TermQuery;diff --git a/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java b/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.javaindex abe5a6d6fd7..a3b7615dc85 100644--- a/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java+++ b/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarity2.java@@ -24,7 +24,7 @@ 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.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.Term;@@ -163,7 +163,7 @@ public class TestSimilarity2 extends LuceneTestCase {RandomIndexWriter iw = new RandomIndexWriter(random(), dir);Document doc = new Document();FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);- ft.setIndexOptions(IndexOptions.DOCS_ONLY);+ ft.setIndexOptions(IndexOptions.DOCS);ft.freeze();Field f = newField("foo", "bar", ft);doc.add(f);@@ -188,7 +188,7 @@ public class TestSimilarity2 extends LuceneTestCase {RandomIndexWriter iw = new RandomIndexWriter(random(), dir);Document doc = new Document();FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);- ft.setIndexOptions(IndexOptions.DOCS_ONLY);+ ft.setIndexOptions(IndexOptions.DOCS);ft.setOmitNorms(true);ft.freeze();Field f = newField("foo", "bar", ft);diff --git a/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java b/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.javaindex 76efaee992f..e09734b39f6 100644--- a/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java+++ b/lucene/core/src/test/org/apache/lucene/search/similarities/TestSimilarityBase.java@@ -26,6 +26,7 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.TextField;import org.apache.lucene.index.FieldInvertState;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.Term;@@ -111,7 +112,7 @@ public class TestSimilarityBase extends LuceneTestCase {for (int i = 0; i < docs.length; i++) {Document d = new Document();FieldType ft = new FieldType(TextField.TYPE_STORED);- ft.setIndexOptions(null);+ ft.setIndexOptions(IndexOptions.NO);d.add(newField(FIELD_ID, Integer.toString(i), ft));d.add(newTextField(FIELD_BODY, docs[i], Field.Store.YES));writer.addDocument(d);diff --git a/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java b/lucene/facet/src/java/org/apache/lucene/facet/FacetField.javaindex cedbc12f176..2b2a39e0c6c 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/FacetField.java@@ -22,7 +22,7 @@ import java.util.Arrays;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;/*** Add an instance of this to your {@link Document} for every facet label.diff --git a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.java b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.javaindex 493cf10e47d..d24491dce45 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetField.java@@ -20,7 +20,7 @@ package org.apache.lucene.facet.sortedset;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.facet.FacetField;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;/** Add an instance of this to your Document for every facet* label to be indexed via SortedSetDocValues. */diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.javaindex 3aa36af1038..216595ed542 100644--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.java+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/AssociationFacetField.java@@ -24,7 +24,7 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.facet.FacetField;import org.apache.lucene.facet.Facets;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.util.BytesRef;/** Add an instance of this to your {@link Document} to adddiff --git a/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java b/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.javaindex 45c7338a185..d5fc31ace90 100644--- a/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java+++ b/lucene/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java@@ -35,7 +35,7 @@ import org.apache.lucene.document.IntField;import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.document.SortedDocValuesField;import org.apache.lucene.index.DirectoryReader;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.MultiDocValues;import org.apache.lucene.index.NumericDocValues;diff --git a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.javaindex f5942b0a267..3f2f6da307a 100644--- a/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java+++ b/lucene/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java@@ -17,16 +17,19 @@package org.apache.lucene.search.grouping;+import java.io.IOException;+import java.util.*;+import org.apache.lucene.analysis.MockAnalyzer;import org.apache.lucene.document.*;-import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.DirectoryReader;+import org.apache.lucene.index.IndexOptions;+import org.apache.lucene.index.IndexReaderContext;+import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.MultiDocValues;import org.apache.lucene.index.NumericDocValues;-import org.apache.lucene.index.ReaderUtil;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.RandomIndexWriter;-import org.apache.lucene.index.IndexReaderContext;+import org.apache.lucene.index.ReaderUtil;import org.apache.lucene.index.SlowCompositeReaderWrapper;import org.apache.lucene.index.Term;import org.apache.lucene.queries.function.ValueSource;@@ -45,9 +48,6 @@ import org.apache.lucene.util.TestUtil;import org.apache.lucene.util.mutable.MutableValue;import org.apache.lucene.util.mutable.MutableValueStr;-import java.io.IOException;-import java.util.*;-// TODO// - should test relevance sort too// - test null@@ -551,7 +551,7 @@ public class TestGrouping extends LuceneTestCase {final List<List<Document>> updateDocs = new ArrayList<>();FieldType groupEndType = new FieldType(StringField.TYPE_NOT_STORED);- groupEndType.setIndexOptions(IndexOptions.DOCS_ONLY);+ groupEndType.setIndexOptions(IndexOptions.DOCS);groupEndType.setOmitNorms(true);//System.out.println("TEST: index groups");diff --git a/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java b/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.javaindex 4e6731d98d1..14f364bde6e 100644--- a/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java+++ b/lucene/highlighter/src/java/org/apache/lucene/search/postingshighlight/PostingsHighlighter.java@@ -31,13 +31,13 @@ import java.util.SortedSet;import java.util.TreeSet;import org.apache.lucene.analysis.Analyzer;-import org.apache.lucene.index.LeafReader;-import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexReaderContext;+import org.apache.lucene.index.LeafReader;+import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.MultiReader;import org.apache.lucene.index.ReaderUtil;import org.apache.lucene.index.StoredFieldVisitor;diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.java b/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.javaindex 741fd257539..074039243c5 100644--- a/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.java+++ b/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestMultiTermHighlighting.java@@ -24,11 +24,11 @@ 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.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.Term;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.queries.TermFilter;import org.apache.lucene.search.BooleanClause;import org.apache.lucene.search.BooleanQuery;diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java b/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.javaindex d920f2895e8..177fcc092ee 100644--- a/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java+++ b/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighter.java@@ -33,7 +33,7 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.index.RandomIndexWriter;diff --git a/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.java b/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.javaindex 78060c3f9ee..df3d7b6c238 100644--- a/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.java+++ b/lucene/highlighter/src/test/org/apache/lucene/search/postingshighlight/TestPostingsHighlighterRanking.java@@ -28,7 +28,7 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.index.RandomIndexWriter;diff --git a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.javaindex 8c4b85ee7db..2587085e5e4 100644--- a/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java+++ b/lucene/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java@@ -17,21 +17,31 @@ package org.apache.lucene.index.memory;* limitations under the License.*/+import java.io.IOException;+import java.util.Arrays;+import java.util.Collection;+import java.util.Comparator;+import java.util.HashMap;+import java.util.Iterator;+import java.util.Map;+import java.util.NoSuchElementException;+import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.analysis.TokenStream;import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute;-import org.apache.lucene.index.LeafReader;import org.apache.lucene.index.BinaryDocValues;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.FieldInvertState;import org.apache.lucene.index.Fields;+import org.apache.lucene.index.IndexOptions;+import org.apache.lucene.index.LeafReader;import org.apache.lucene.index.NumericDocValues;import org.apache.lucene.index.OrdTermState;import org.apache.lucene.index.SortedDocValues;@@ -51,25 +61,16 @@ import org.apache.lucene.util.ArrayUtil;import org.apache.lucene.util.Bits;import org.apache.lucene.util.ByteBlockPool;import org.apache.lucene.util.BytesRef;-import org.apache.lucene.util.BytesRefHash;import org.apache.lucene.util.BytesRefHash.DirectBytesStartArray;+import org.apache.lucene.util.BytesRefHash;import org.apache.lucene.util.Counter;-import org.apache.lucene.util.IntBlockPool;import org.apache.lucene.util.IntBlockPool.SliceReader;import org.apache.lucene.util.IntBlockPool.SliceWriter;+import org.apache.lucene.util.IntBlockPool;import org.apache.lucene.util.RamUsageEstimator;import org.apache.lucene.util.RecyclingByteBlockAllocator;import org.apache.lucene.util.RecyclingIntBlockAllocator;-import java.io.IOException;-import java.util.Arrays;-import java.util.Collection;-import java.util.Comparator;-import java.util.HashMap;-import java.util.Iterator;-import java.util.Map;-import java.util.NoSuchElementException;-/*** High-performance single-document main memory Apache Lucene fulltext search index.@@ -447,7 +448,9 @@ public class MemoryIndex {if (!fieldInfos.containsKey(fieldName)) {fieldInfos.put(fieldName,- new FieldInfo(fieldName, fieldInfos.size(), false, false, false, this.storeOffsets ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, null, -1, null));+ new FieldInfo(fieldName, fieldInfos.size(), false, false, false,+ this.storeOffsets ? IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : IndexOptions.DOCS_AND_FREQS_AND_POSITIONS,+ DocValuesType.NO, -1, null));}TermToBytesRefAttribute termAtt = stream.getAttribute(TermToBytesRefAttribute.class);PositionIncrementAttribute posIncrAttribute = stream.addAttribute(PositionIncrementAttribute.class);diff --git a/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java b/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.javaindex 39be3beaf25..f1bdc7f9d11 100644--- a/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java+++ b/lucene/memory/src/test/org/apache/lucene/index/memory/TestMemoryIndexAgainstRAMDir.java@@ -40,16 +40,17 @@ 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.LeafReader;import org.apache.lucene.index.CompositeReader;import org.apache.lucene.index.DirectoryReader;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;import org.apache.lucene.index.Fields;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.index.IndexableField;+import org.apache.lucene.index.LeafReader;import org.apache.lucene.index.NumericDocValues;import org.apache.lucene.index.SlowCompositeReaderWrapper;import org.apache.lucene.index.Term;@@ -432,7 +433,7 @@ public class TestMemoryIndexAgainstRAMDir extends BaseTokenStreamTestCase {Document nextDoc = lineFileDocs.nextDoc();Document doc = new Document();for (Field field : nextDoc.getFields()) {- if (field.fieldType().indexOptions() != null) {+ if (field.fieldType().indexOptions() != IndexOptions.NO) {doc.add(field);if (random().nextInt(3) == 0) {doc.add(field); // randomly add the same field twicediff --git a/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.java b/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.javaindex 2da53b02415..087bdd3df10 100644--- a/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.java+++ b/lucene/misc/src/java/org/apache/lucene/index/sorter/SortingLeafReader.java@@ -25,7 +25,7 @@ import org.apache.lucene.index.LeafReader;import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;import org.apache.lucene.index.NumericDocValues;diff --git a/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java b/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.javaindex 1eb7b028207..741a553adb3 100644--- a/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java+++ b/lucene/misc/src/java/org/apache/lucene/uninverting/UninvertingReader.java@@ -32,6 +32,7 @@ import org.apache.lucene.document.SortedSetDocValuesField; // javadocsimport org.apache.lucene.document.StringField; // javadocsimport org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DirectoryReader;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.FilterDirectoryReader;@@ -183,7 +184,7 @@ public class UninvertingReader extends FilterLeafReader {this.mapping = mapping;ArrayList<FieldInfo> filteredInfos = new ArrayList<>();for (FieldInfo fi : in.getFieldInfos()) {- FieldInfo.DocValuesType type = fi.getDocValuesType();+ DocValuesType type = fi.getDocValuesType();if (fi.isIndexed() && !fi.hasDocValues()) {Type t = mapping.get(fi.name);if (t != null) {@@ -192,20 +193,20 @@ public class UninvertingReader extends FilterLeafReader {case LONG:case FLOAT:case DOUBLE:- type = FieldInfo.DocValuesType.NUMERIC;+ type = DocValuesType.NUMERIC;break;case BINARY:- type = FieldInfo.DocValuesType.BINARY;+ type = DocValuesType.BINARY;break;case SORTED:- type = FieldInfo.DocValuesType.SORTED;+ type = DocValuesType.SORTED;break;case SORTED_SET_BINARY:case SORTED_SET_INTEGER:case SORTED_SET_FLOAT:case SORTED_SET_LONG:case SORTED_SET_DOUBLE:- type = FieldInfo.DocValuesType.SORTED_SET;+ type = DocValuesType.SORTED_SET;break;default:throw new AssertionError();diff --git a/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.java b/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.javaindex 1035757c806..48b8a28667e 100644--- a/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.java+++ b/lucene/misc/src/test/org/apache/lucene/index/sorter/SorterTestBase.java@@ -31,8 +31,8 @@ import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;import org.apache.lucene.document.BinaryDocValuesField;import org.apache.lucene.document.Document;-import org.apache.lucene.document.Field;import org.apache.lucene.document.Field.Store;+import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.document.SortedDocValuesField;@@ -40,15 +40,15 @@ import org.apache.lucene.document.SortedNumericDocValuesField;import org.apache.lucene.document.SortedSetDocValuesField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.LeafReader;-import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DirectoryReader;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInvertState;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexWriterConfig;+import org.apache.lucene.index.LeafReader;+import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.NumericDocValues;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.SlowCompositeReaderWrapper;@@ -57,8 +57,8 @@ import org.apache.lucene.index.SortedNumericDocValues;import org.apache.lucene.index.SortedSetDocValues;import org.apache.lucene.index.Term;import org.apache.lucene.index.Terms;-import org.apache.lucene.index.TermsEnum;import org.apache.lucene.index.TermsEnum.SeekStatus;+import org.apache.lucene.index.TermsEnum;import org.apache.lucene.index.sorter.SortingLeafReader.SortingDocsAndPositionsEnum;import org.apache.lucene.index.sorter.SortingLeafReader.SortingDocsEnum;import org.apache.lucene.search.CollectionStatistics;diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.javaindex 7585e7b7792..aeda1e172cb 100644--- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java+++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/BytesRefFieldSource.java@@ -23,7 +23,7 @@ import java.util.Map;import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocValues;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.queries.function.FunctionValues;import org.apache.lucene.queries.function.docvalues.DocTermsIndexDocValues;diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.javaindex beae905cbcd..24bdbbf40fc 100644--- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java+++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestDocValuesFieldSources.java@@ -27,7 +27,7 @@ import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.document.SortedDocValuesField;import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.DirectoryReader;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.IndexWriterConfig;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.queries.function.valuesource.BytesRefFieldSource;@@ -146,7 +146,7 @@ public class TestDocValuesFieldSources extends LuceneTestCase {public void test() throws IOException {for (DocValuesType type : DocValuesType.values()) {- if (type != DocValuesType.SORTED_SET && type != DocValuesType.SORTED_NUMERIC) {+ if (type != DocValuesType.SORTED_SET && type != DocValuesType.SORTED_NUMERIC && type != DocValuesType.NO) {test(type);}}diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.javaindex 4cc8e7ec931..722e748ddcc 100644--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.java+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/analyzing/TestAnalyzingQueryParser.java@@ -34,7 +34,7 @@ import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.index.DirectoryReader;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.queryparser.classic.ParseException;import org.apache.lucene.queryparser.classic.QueryParser;diff --git a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.java b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.javaindex 6d7e4d3d7c5..9d25fd3cc3a 100644--- a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.java+++ b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionPostingsWriter.java@@ -23,6 +23,7 @@ import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.PushPostingsWriterBase;import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.store.DataOutput;import org.apache.lucene.store.IndexOutput;@@ -63,7 +64,7 @@ final class IDVersionPostingsWriter extends PushPostingsWriterBase {@Overridepublic int setField(FieldInfo fieldInfo) {super.setField(fieldInfo);- if (fieldInfo.getIndexOptions() != FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) {+ if (fieldInfo.getIndexOptions() != IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) {throw new IllegalArgumentException("field must be index using IndexOptions.DOCS_AND_FREQS_AND_POSITIONS");}// LUCENE-5693: because CheckIndex cross-checks term vectors with postings even for deleted docs, and because our PF only indexes thediff --git a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.javaindex 36d2ba9012f..481e74d9ad6 100644--- a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java+++ b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnum.java@@ -23,7 +23,7 @@ import java.io.PrintStream;import org.apache.lucene.codecs.BlockTermState;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.TermState;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.ByteArrayDataInput;diff --git a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.java b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.javaindex 314f4a15fa5..f789d76626e 100644--- a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.java+++ b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/IDVersionSegmentTermsEnumFrame.java@@ -20,7 +20,6 @@ package org.apache.lucene.codecs.idversion;import java.io.IOException;import org.apache.lucene.codecs.BlockTermState;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.TermsEnum.SeekStatus;import org.apache.lucene.store.ByteArrayDataInput;import org.apache.lucene.util.ArrayUtil;diff --git a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.java b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.javaindex a055396cdb7..6bdf7b1fb74 100644--- a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.java+++ b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionBlockTreeTermsWriter.java@@ -26,11 +26,11 @@ import org.apache.lucene.codecs.CodecUtil;import org.apache.lucene.codecs.FieldsConsumer;import org.apache.lucene.codecs.PostingsWriterBase;import org.apache.lucene.codecs.blocktree.BlockTreeTermsWriter;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;@@ -748,7 +748,7 @@ public final class VersionBlockTreeTermsWriter extends FieldsConsumer {// TODO: LUCENE-5693: we don't need this check if we fix IW to not send deleted docs to us on flush:if (state != null && ((IDVersionPostingsWriter) postingsWriter).lastDocID != -1) {assert state.docFreq != 0;- assert fieldInfo.getIndexOptions() == IndexOptions.DOCS_ONLY || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;+ assert fieldInfo.getIndexOptions() == IndexOptions.DOCS || state.totalTermFreq >= state.docFreq: "postingsWriter=" + postingsWriter;pushTerm(text);PendingTerm term = new PendingTerm(BytesRef.deepCopyOf(text), state);diff --git a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.java b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.javaindex 6cc6392f340..a7872375c0a 100644--- a/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.java+++ b/lucene/sandbox/src/java/org/apache/lucene/codecs/idversion/VersionFieldReader.java@@ -21,7 +21,7 @@ import java.io.IOException;import java.util.Collections;import org.apache.lucene.index.FieldInfo;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.store.ByteArrayDataInput;diff --git a/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.java b/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.javaindex 31819a0a588..45143514ab6 100644--- a/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.java+++ b/lucene/sandbox/src/test/org/apache/lucene/codecs/idversion/StringAndPayloadField.java@@ -25,7 +25,7 @@ import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.util.BytesRef;// TODO: can we take a BytesRef token instead?diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java b/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.javaindex 1dbe70f5551..a6bba846147 100644--- a/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java@@ -17,15 +17,11 @@ package org.apache.lucene.spatial.bbox;* limitations under the License.*/-import com.spatial4j.core.context.SpatialContext;-import com.spatial4j.core.shape.Point;-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.document.StringField;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.Term;import org.apache.lucene.queries.function.ValueSource;@@ -44,6 +40,10 @@ import org.apache.lucene.spatial.query.UnsupportedSpatialOperation;import org.apache.lucene.spatial.util.DistanceToShapeValueSource;import org.apache.lucene.util.BytesRefBuilder;import org.apache.lucene.util.NumericUtils;+import com.spatial4j.core.context.SpatialContext;+import com.spatial4j.core.shape.Point;+import com.spatial4j.core.shape.Rectangle;+import com.spatial4j.core.shape.Shape;/**@@ -106,7 +106,7 @@ public class BBoxStrategy extends SpatialStrategy {FieldType fieldType = new FieldType(DoubleField.TYPE_NOT_STORED);fieldType.setNumericPrecisionStep(8);//Solr's default- fieldType.setDocValueType(FieldInfo.DocValuesType.NUMERIC);+ fieldType.setDocValueType(DocValuesType.NUMERIC);setFieldType(fieldType);}diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.javaindex fe77af64807..8be685511fe 100644--- a/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/PrefixTreeStrategy.java@@ -17,22 +17,23 @@ package org.apache.lucene.spatial.prefix;* limitations under the License.*/-import com.spatial4j.core.shape.Point;-import com.spatial4j.core.shape.Shape;+import java.util.Iterator;+import java.util.Map;+import java.util.concurrent.ConcurrentHashMap;+import org.apache.lucene.analysis.TokenStream;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.queries.function.ValueSource;import org.apache.lucene.spatial.SpatialStrategy;import org.apache.lucene.spatial.prefix.tree.Cell;import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;import org.apache.lucene.spatial.query.SpatialArgs;import org.apache.lucene.spatial.util.ShapeFieldCacheDistanceValueSource;--import java.util.Iterator;-import java.util.Map;-import java.util.concurrent.ConcurrentHashMap;+import com.spatial4j.core.shape.Point;+import com.spatial4j.core.shape.Shape;/*** An abstract SpatialStrategy based on {@link SpatialPrefixTree}. The two@@ -144,7 +145,7 @@ public abstract class PrefixTreeStrategy extends SpatialStrategy {static {FIELD_TYPE.setTokenized(true);FIELD_TYPE.setOmitNorms(true);- FIELD_TYPE.setIndexOptions(FieldInfo.IndexOptions.DOCS_ONLY);+ FIELD_TYPE.setIndexOptions(IndexOptions.DOCS);FIELD_TYPE.freeze();}diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java b/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.javaindex cb2786e1583..ae0a143ee2d 100644--- a/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java@@ -17,12 +17,13 @@ package org.apache.lucene.spatial;* limitations under the License.*/-import com.carrotsearch.randomizedtesting.annotations.Name;-import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;-import com.spatial4j.core.context.SpatialContext;-import com.spatial4j.core.shape.Point;-import com.spatial4j.core.shape.Shape;+import java.io.IOException;+import java.util.ArrayList;+import java.util.Arrays;+import java.util.List;+import org.apache.lucene.document.FieldType;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.spatial.bbox.BBoxStrategy;import org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy;import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy;@@ -32,11 +33,11 @@ import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;import org.apache.lucene.spatial.serialized.SerializedDVStrategy;import org.apache.lucene.spatial.vector.PointVectorStrategy;import org.junit.Test;--import java.io.IOException;-import java.util.ArrayList;-import java.util.Arrays;-import java.util.List;+import com.carrotsearch.randomizedtesting.annotations.Name;+import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;+import com.spatial4j.core.context.SpatialContext;+import com.spatial4j.core.shape.Point;+import com.spatial4j.core.shape.Shape;public class DistanceStrategyTest extends StrategyTestCase {@@ -96,7 +97,7 @@ public class DistanceStrategyTest extends StrategyTestCase {if (strategy instanceof BBoxStrategy && random().nextBoolean()) {//disable indexing sometimesBBoxStrategy bboxStrategy = (BBoxStrategy)strategy;final FieldType fieldType = new FieldType(bboxStrategy.getFieldType());- fieldType.setIndexOptions(null);+ fieldType.setIndexOptions(IndexOptions.NO);bboxStrategy.setFieldType(fieldType);}}diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java b/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.javaindex 7322afb0f80..33b02dccfea 100644--- a/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/bbox/TestBBoxStrategy.java@@ -17,14 +17,11 @@ package org.apache.lucene.spatial.bbox;* limitations under the License.*/-import com.carrotsearch.randomizedtesting.annotations.Repeat;-import com.spatial4j.core.context.SpatialContext;-import com.spatial4j.core.context.SpatialContextFactory;-import com.spatial4j.core.distance.DistanceUtils;-import com.spatial4j.core.shape.Rectangle;-import com.spatial4j.core.shape.Shape;-import com.spatial4j.core.shape.impl.RectangleImpl;+import java.io.IOException;+import org.apache.lucene.document.FieldType;+import org.apache.lucene.index.DocValuesType;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.search.Query;import org.apache.lucene.spatial.SpatialMatchConcern;import org.apache.lucene.spatial.prefix.RandomSpatialOpStrategyTestCase;@@ -33,8 +30,13 @@ import org.apache.lucene.spatial.query.SpatialOperation;import org.apache.lucene.spatial.util.ShapeAreaValueSource;import org.junit.Ignore;import org.junit.Test;--import java.io.IOException;+import com.carrotsearch.randomizedtesting.annotations.Repeat;+import com.spatial4j.core.context.SpatialContext;+import com.spatial4j.core.context.SpatialContextFactory;+import com.spatial4j.core.distance.DistanceUtils;+import com.spatial4j.core.shape.Rectangle;+import com.spatial4j.core.shape.Shape;+import com.spatial4j.core.shape.impl.RectangleImpl;public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {@@ -110,7 +112,7 @@ public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {if (random().nextBoolean()) {BBoxStrategy bboxStrategy = (BBoxStrategy) strategy;FieldType fieldType = new FieldType(bboxStrategy.getFieldType());- fieldType.setDocValueType(null);+ fieldType.setDocValueType(DocValuesType.NO);bboxStrategy.setFieldType(fieldType);}for (SpatialOperation operation : SpatialOperation.values()) {@@ -292,7 +294,7 @@ public class TestBBoxStrategy extends RandomSpatialOpStrategyTestCase {BBoxStrategy bboxStrategy = (BBoxStrategy) strategy;if (random().nextBoolean()) {FieldType fieldType = new FieldType(bboxStrategy.getFieldType());- fieldType.setIndexOptions(null);+ fieldType.setIndexOptions(IndexOptions.NO);bboxStrategy.setFieldType(fieldType);}diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.javaindex c2fa23f216b..126322d03d8 100644--- a/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java+++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/SpellChecker.java@@ -25,15 +25,15 @@ import java.util.List;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.document.StringField;-import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.DirectoryReader;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriter;+import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.index.IndexWriterConfig;+import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.Term;-import org.apache.lucene.index.IndexWriterConfig.OpenMode;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.search.BooleanClause;diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.javaindex 28fefe49975..80b8bf50c86 100644--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/AnalyzingInfixSuggester.java@@ -41,15 +41,14 @@ import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.document.SortedSetDocValuesField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FilterLeafReader;-import org.apache.lucene.index.LeafReader;-import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DirectoryReader;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FilterLeafReader;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.IndexWriterConfig;+import org.apache.lucene.index.LeafReader;+import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.MultiDocValues;import org.apache.lucene.index.ReaderUtil;import org.apache.lucene.index.SegmentReader;@@ -378,7 +377,7 @@ public class AnalyzingInfixSuggester extends Lookup implements Closeable {*/protected FieldType getTextFieldType(){FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);- ft.setIndexOptions(IndexOptions.DOCS_ONLY);+ ft.setIndexOptions(IndexOptions.DOCS);ft.setOmitNorms(true);return ft;diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.javaindex 007b095e635..4e911da8eeb 100644--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/BlendedInfixSuggester.java@@ -29,7 +29,7 @@ import org.apache.lucene.document.FieldType;import org.apache.lucene.document.TextField;import org.apache.lucene.index.BinaryDocValues;import org.apache.lucene.index.DocsAndPositionsEnum;-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.MultiDocValues;import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;@@ -149,7 +149,7 @@ public class BlendedInfixSuggester extends AnalyzingInfixSuggester {@Overrideprotected FieldType getTextFieldType() {FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);- ft.setIndexOptions(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);ft.setStoreTermVectors(true);ft.setStoreTermVectorPositions(true);ft.setOmitNorms(true);diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.javaindex 222f15a28a2..c1f4235607b 100644--- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java+++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/analyzing/FreeTextSuggester.java@@ -21,6 +21,17 @@ package org.apache.lucene.search.suggest.analyzing;// - test w/ syns// - add pruning of low-freq ngrams?+import java.io.File;+import java.io.IOException;+import java.nio.file.Files;+import java.nio.file.Path;+import java.util.ArrayList;+import java.util.Collections;+import java.util.Comparator;+import java.util.HashSet;+import java.util.List;+import java.util.Set;+import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.analysis.AnalyzerWrapper;import org.apache.lucene.analysis.TokenStream;@@ -35,7 +46,7 @@ import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.TextField;import org.apache.lucene.index.DirectoryReader;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.IndexWriterConfig;@@ -58,25 +69,14 @@ import org.apache.lucene.util.IOUtils;import org.apache.lucene.util.IntsRef;import org.apache.lucene.util.IntsRefBuilder;import org.apache.lucene.util.fst.Builder;-import org.apache.lucene.util.fst.FST;import org.apache.lucene.util.fst.FST.Arc;import org.apache.lucene.util.fst.FST.BytesReader;+import org.apache.lucene.util.fst.FST;import org.apache.lucene.util.fst.Outputs;import org.apache.lucene.util.fst.PositiveIntOutputs;-import org.apache.lucene.util.fst.Util;import org.apache.lucene.util.fst.Util.Result;import org.apache.lucene.util.fst.Util.TopResults;--import java.io.File;-import java.io.IOException;-import java.nio.file.Files;-import java.nio.file.Path;-import java.util.ArrayList;-import java.util.Collections;-import java.util.Comparator;-import java.util.HashSet;-import java.util.List;-import java.util.Set;+import org.apache.lucene.util.fst.Util;//import java.io.PrintWriter;diff --git a/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.javaindex aedac0ab774..f5f42d2827c 100644--- a/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/analysis/BaseTokenStreamTestCase.java@@ -34,7 +34,7 @@ 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.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.store.Directory;import org.apache.lucene.util.Attribute;@@ -568,15 +568,15 @@ public abstract class BaseTokenStreamTestCase extends LuceneTestCase {ft.setOmitNorms(true);}switch(random.nextInt(4)) {- case 0: ft.setIndexOptions(IndexOptions.DOCS_ONLY); break;+ case 0: ft.setIndexOptions(IndexOptions.DOCS); break;case 1: ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS); break;case 2: ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS); break;default:- if (offsetsAreCorrect) {- ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);- } else {- ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);- }+ if (offsetsAreCorrect) {+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);+ } else {+ ft.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);+ }}currentField = field = new Field("dummy", bogus, ft);doc.add(currentField);diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.javaindex ef0f466c8b2..491004918aa 100644--- a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.java+++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingDocValuesFormat.java@@ -23,8 +23,11 @@ import java.util.Iterator;import org.apache.lucene.codecs.DocValuesConsumer;import org.apache.lucene.codecs.DocValuesFormat;import org.apache.lucene.codecs.DocValuesProducer;+import org.apache.lucene.index.AssertingLeafReader.AssertingRandomAccessOrds;+import org.apache.lucene.index.AssertingLeafReader.AssertingSortedSetDocValues;import org.apache.lucene.index.AssertingLeafReader;import org.apache.lucene.index.BinaryDocValues;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.NumericDocValues;import org.apache.lucene.index.RandomAccessOrds;@@ -33,8 +36,6 @@ import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.SortedDocValues;import org.apache.lucene.index.SortedNumericDocValues;import org.apache.lucene.index.SortedSetDocValues;-import org.apache.lucene.index.AssertingLeafReader.AssertingRandomAccessOrds;-import org.apache.lucene.index.AssertingLeafReader.AssertingSortedSetDocValues;import org.apache.lucene.util.Accountable;import org.apache.lucene.util.Bits;import org.apache.lucene.util.BytesRef;@@ -225,7 +226,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {@Overridepublic NumericDocValues getNumeric(FieldInfo field) throws IOException {- assert field.getDocValuesType() == FieldInfo.DocValuesType.NUMERIC;+ assert field.getDocValuesType() == DocValuesType.NUMERIC;NumericDocValues values = in.getNumeric(field);assert values != null;return new AssertingLeafReader.AssertingNumericDocValues(values, maxDoc);@@ -233,7 +234,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {@Overridepublic BinaryDocValues getBinary(FieldInfo field) throws IOException {- assert field.getDocValuesType() == FieldInfo.DocValuesType.BINARY;+ assert field.getDocValuesType() == DocValuesType.BINARY;BinaryDocValues values = in.getBinary(field);assert values != null;return new AssertingLeafReader.AssertingBinaryDocValues(values, maxDoc);@@ -241,7 +242,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {@Overridepublic SortedDocValues getSorted(FieldInfo field) throws IOException {- assert field.getDocValuesType() == FieldInfo.DocValuesType.SORTED;+ assert field.getDocValuesType() == DocValuesType.SORTED;SortedDocValues values = in.getSorted(field);assert values != null;return new AssertingLeafReader.AssertingSortedDocValues(values, maxDoc);@@ -249,7 +250,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {@Overridepublic SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOException {- assert field.getDocValuesType() == FieldInfo.DocValuesType.SORTED_NUMERIC;+ assert field.getDocValuesType() == DocValuesType.SORTED_NUMERIC;SortedNumericDocValues values = in.getSortedNumeric(field);assert values != null;return new AssertingLeafReader.AssertingSortedNumericDocValues(values, maxDoc);@@ -257,7 +258,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {@Overridepublic SortedSetDocValues getSortedSet(FieldInfo field) throws IOException {- assert field.getDocValuesType() == FieldInfo.DocValuesType.SORTED_SET;+ assert field.getDocValuesType() == DocValuesType.SORTED_SET;SortedSetDocValues values = in.getSortedSet(field);assert values != null;if (values instanceof RandomAccessOrds) {@@ -269,7 +270,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {@Overridepublic Bits getDocsWithField(FieldInfo field) throws IOException {- assert field.getDocValuesType() != null;+ assert field.getDocValuesType() != DocValuesType.NO;Bits bits = in.getDocsWithField(field);assert bits != null;assert bits.length() == maxDoc;diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.javaindex 0a1ae6db455..ae0225305db 100644--- a/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java+++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/asserting/AssertingPostingsFormat.java@@ -28,6 +28,7 @@ import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.Fields;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.Terms;@@ -160,9 +161,9 @@ public final class AssertingPostingsFormat extends PostingsFormat {DocsEnum docsEnum = null;DocsAndPositionsEnum posEnum = null;- boolean hasFreqs = fieldInfo.getIndexOptions().compareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS) >= 0;- boolean hasPositions = fieldInfo.getIndexOptions().compareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;- boolean hasOffsets = fieldInfo.getIndexOptions().compareTo(FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;+ boolean hasFreqs = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS) >= 0;+ boolean hasPositions = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;+ boolean hasOffsets = fieldInfo.getIndexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;boolean hasPayloads = terms.hasPayloads();assert hasPositions == terms.hasPositions();diff --git a/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java b/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.javaindex f811984471d..2b040571099 100644--- a/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java+++ b/lucene/test-framework/src/java/org/apache/lucene/codecs/ramonly/RAMOnlyPostingsFormat.java@@ -35,10 +35,10 @@ import org.apache.lucene.codecs.PostingsFormat;import org.apache.lucene.codecs.TermStats;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.Fields;import org.apache.lucene.index.IndexFileNames;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.SegmentReadState;import org.apache.lucene.index.SegmentWriteState;import org.apache.lucene.index.Terms;@@ -142,7 +142,7 @@ public final class RAMOnlyPostingsFormat extends PostingsFormat {public long getSumTotalTermFreq() {return sumTotalTermFreq;}-+@Overridepublic long getSumDocFreq() throws IOException {return sumDocFreq;diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.javaindex 19c95edc984..38aa47d434f 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/AssertingLeafReader.java@@ -679,10 +679,10 @@ public class AssertingLeafReader extends FilterLeafReader {FieldInfo fi = getFieldInfos().fieldInfo(field);if (dv != null) {assert fi != null;- assert fi.getDocValuesType() == FieldInfo.DocValuesType.NUMERIC;+ assert fi.getDocValuesType() == DocValuesType.NUMERIC;return new AssertingNumericDocValues(dv, maxDoc());} else {- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.NUMERIC;+ assert fi == null || fi.getDocValuesType() != DocValuesType.NUMERIC;return null;}}@@ -693,10 +693,10 @@ public class AssertingLeafReader extends FilterLeafReader {FieldInfo fi = getFieldInfos().fieldInfo(field);if (dv != null) {assert fi != null;- assert fi.getDocValuesType() == FieldInfo.DocValuesType.BINARY;+ assert fi.getDocValuesType() == DocValuesType.BINARY;return new AssertingBinaryDocValues(dv, maxDoc());} else {- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.BINARY;+ assert fi == null || fi.getDocValuesType() != DocValuesType.BINARY;return null;}}@@ -707,10 +707,10 @@ public class AssertingLeafReader extends FilterLeafReader {FieldInfo fi = getFieldInfos().fieldInfo(field);if (dv != null) {assert fi != null;- assert fi.getDocValuesType() == FieldInfo.DocValuesType.SORTED;+ assert fi.getDocValuesType() == DocValuesType.SORTED;return new AssertingSortedDocValues(dv, maxDoc());} else {- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.SORTED;+ assert fi == null || fi.getDocValuesType() != DocValuesType.SORTED;return null;}}@@ -721,10 +721,10 @@ public class AssertingLeafReader extends FilterLeafReader {FieldInfo fi = getFieldInfos().fieldInfo(field);if (dv != null) {assert fi != null;- assert fi.getDocValuesType() == FieldInfo.DocValuesType.SORTED_NUMERIC;+ assert fi.getDocValuesType() == DocValuesType.SORTED_NUMERIC;return new AssertingSortedNumericDocValues(dv, maxDoc());} else {- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.SORTED_NUMERIC;+ assert fi == null || fi.getDocValuesType() != DocValuesType.SORTED_NUMERIC;return null;}}@@ -735,14 +735,14 @@ public class AssertingLeafReader extends FilterLeafReader {FieldInfo fi = getFieldInfos().fieldInfo(field);if (dv != null) {assert fi != null;- assert fi.getDocValuesType() == FieldInfo.DocValuesType.SORTED_SET;+ assert fi.getDocValuesType() == DocValuesType.SORTED_SET;if (dv instanceof RandomAccessOrds) {return new AssertingRandomAccessOrds((RandomAccessOrds) dv, maxDoc());} else {return new AssertingSortedSetDocValues(dv, maxDoc());}} else {- assert fi == null || fi.getDocValuesType() != FieldInfo.DocValuesType.SORTED_SET;+ assert fi == null || fi.getDocValuesType() != DocValuesType.SORTED_SET;return null;}}diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.javaindex 62fb4567b3c..211bf458c59 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseFieldInfoFormatTestCase.java@@ -27,8 +27,6 @@ import org.apache.lucene.document.Document;import org.apache.lucene.document.FieldType;import org.apache.lucene.document.StoredField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.DocValuesType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.store.Directory;import org.apache.lucene.store.IOContext;import org.apache.lucene.util.StringHelper;@@ -84,7 +82,7 @@ public abstract class BaseFieldInfoFormatTestCase extends BaseIndexFileFormatTesfor (String field : fieldNames) {IndexableFieldType fieldType = randomFieldType(random());FieldInfo fi = builder.addOrUpdate(field, fieldType);- if (fieldType.indexOptions() != null && fieldType.indexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) {+ if (fieldType.indexOptions() != IndexOptions.NO && fieldType.indexOptions().compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) {if (random().nextBoolean()) {fi.setStorePayloads();}diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.javaindex 8aed6c664b2..8f3efcaebe0 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BasePostingsFormatTestCase.java@@ -45,7 +45,6 @@ import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.index.TermsEnum.SeekStatus;import org.apache.lucene.store.Directory;import org.apache.lucene.store.FlushInfo;@@ -372,7 +371,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTestfieldInfoArray[fieldUpto] = new FieldInfo(field, fieldUpto, false, false, true,IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,- null, -1, null);+ DocValuesType.NO, -1, null);fieldUpto++;SortedMap<BytesRef,SeedAndOrd> postings = new TreeMap<>();@@ -414,7 +413,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTest// NOTE: sort of silly: we enum all the docs just to// get the maxDoc- DocsEnum docsEnum = getSeedPostings(term, termSeed, false, IndexOptions.DOCS_ONLY, true);+ DocsEnum docsEnum = getSeedPostings(term, termSeed, false, IndexOptions.DOCS, true);int doc;int lastDoc = 0;while((doc = docsEnum.nextDoc()) != DocsEnum.NO_MORE_DOCS) {@@ -690,7 +689,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTest// Randomly picked the IndexOptions to index this// field with:- IndexOptions indexOptions = IndexOptions.values()[alwaysTestMax ? maxIndexOption : random().nextInt(1+maxIndexOption)];+ IndexOptions indexOptions = IndexOptions.values()[alwaysTestMax ? maxIndexOption : TestUtil.nextInt(random(), 1, maxIndexOption)];boolean doPayloads = indexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && allowPayloads;newFieldInfoArray[fieldUpto] = new FieldInfo(oldFieldInfo.name,@@ -699,7 +698,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTestfalse,doPayloads,indexOptions,- null,+ DocValuesType.NO,-1,null);}@@ -1358,7 +1357,7 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTest}public void testDocsOnly() throws Exception {- testFull(IndexOptions.DOCS_ONLY, false);+ testFull(IndexOptions.DOCS, false);}public void testDocsAndFreqs() throws Exception {@@ -1736,6 +1735,9 @@ public abstract class BasePostingsFormatTestCase extends BaseIndexFileFormatTest@Overrideprotected void addRandomFields(Document doc) {for (IndexOptions opts : IndexOptions.values()) {+ if (opts == IndexOptions.NO) {+ continue;+ }FieldType ft = new FieldType();ft.setIndexOptions(opts);ft.freeze();diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.javaindex 7fc31b9e3b8..318ce6a157e 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/BaseStoredFieldsFormatTestCase.java@@ -35,10 +35,10 @@ import org.apache.lucene.codecs.StoredFieldsFormat;import org.apache.lucene.codecs.simpletext.SimpleTextCodec;import org.apache.lucene.document.Document;import org.apache.lucene.document.DoubleField;-import org.apache.lucene.document.Field;import org.apache.lucene.document.Field.Store;-import org.apache.lucene.document.FieldType;+import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType.NumericType;+import org.apache.lucene.document.FieldType;import org.apache.lucene.document.FloatField;import org.apache.lucene.document.IntField;import org.apache.lucene.document.LongField;@@ -53,11 +53,10 @@ import org.apache.lucene.search.TermQuery;import org.apache.lucene.search.TopDocs;import org.apache.lucene.store.Directory;import org.apache.lucene.store.MMapDirectory;-import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.store.MockDirectoryWrapper.Throttling;+import org.apache.lucene.store.MockDirectoryWrapper;import org.apache.lucene.util.BytesRef;import org.apache.lucene.util.TestUtil;-import com.carrotsearch.randomizedtesting.generators.RandomInts;import com.carrotsearch.randomizedtesting.generators.RandomPicks;@@ -321,7 +320,7 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormatw.addDocument(doc);IndexReader r = w.getReader();w.close();- assertNull(r.document(0).getField("field").fieldType().indexOptions());+ assertEquals(IndexOptions.NO, r.document(0).getField("field").fieldType().indexOptions());assertNotNull(r.document(0).getField("field2").fieldType().indexOptions());r.close();dir.close();@@ -516,7 +515,7 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormat}final FieldType type = new FieldType(StringField.TYPE_STORED);- type.setIndexOptions(null);+ type.setIndexOptions(IndexOptions.NO);type.freeze();IntField id = new IntField("id", 0, Store.YES);for (int i = 0; i < data.length; ++i) {@@ -606,7 +605,7 @@ public abstract class BaseStoredFieldsFormatTestCase extends BaseIndexFileFormatbigDoc2.add(idField);final FieldType onlyStored = new FieldType(StringField.TYPE_STORED);- onlyStored.setIndexOptions(null);+ onlyStored.setIndexOptions(IndexOptions.NO);final Field smallField = new Field("fld", randomByteArray(random().nextInt(10), 256), onlyStored);final int numFields = RandomInts.randomIntBetween(random(), 500000, 1000000);diff --git a/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java b/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.javaindex c6c7563c949..28ceb6cd683 100644--- a/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java+++ b/lucene/test-framework/src/java/org/apache/lucene/index/DocHelper.java@@ -32,7 +32,6 @@ import org.apache.lucene.document.FieldType;import org.apache.lucene.document.StoredField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;import org.apache.lucene.search.IndexSearcher;import org.apache.lucene.search.similarities.Similarity;import org.apache.lucene.store.Directory;@@ -97,7 +96,7 @@ class DocHelper {public static Field noTFField;static {customType6 = new FieldType(TextField.TYPE_STORED);- customType6.setIndexOptions(IndexOptions.DOCS_ONLY);+ customType6.setIndexOptions(IndexOptions.DOCS);noTFField = new Field(NO_TF_KEY, NO_TF_TEXT, customType6);}@@ -204,15 +203,15 @@ class DocHelper {for (int i=0; i<fields.length; i++) {IndexableField f = fields[i];add(all,f);- if (f.fieldType().indexOptions() != null) add(indexed,f);+ if (f.fieldType().indexOptions() != IndexOptions.NO) add(indexed,f);else add(unindexed,f);if (f.fieldType().storeTermVectors()) add(termvector,f);- if (f.fieldType().indexOptions() != null && !f.fieldType().storeTermVectors()) add(notermvector,f);+ if (f.fieldType().indexOptions() != IndexOptions.NO && !f.fieldType().storeTermVectors()) add(notermvector,f);if (f.fieldType().stored()) add(stored,f);else add(unstored,f);- if (f.fieldType().indexOptions() == IndexOptions.DOCS_ONLY) add(noTf,f);+ if (f.fieldType().indexOptions() == IndexOptions.DOCS) add(noTf,f);if (f.fieldType().omitNorms()) add(noNorms,f);- if (f.fieldType().indexOptions() == IndexOptions.DOCS_ONLY) add(noTf,f);+ if (f.fieldType().indexOptions() == IndexOptions.DOCS) add(noTf,f);//if (f.isLazy()) add(lazy, f);}}diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java b/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.javaindex e39e7070c8b..ec47a18a896 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/LineFileDocs.java@@ -41,7 +41,7 @@ import org.apache.lucene.document.IntField;import org.apache.lucene.document.SortedDocValuesField;import org.apache.lucene.document.StringField;import org.apache.lucene.document.TextField;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;/** Minimal port of benchmark's LneDocSource +* DocMaker, so tests can enum docs from a line file createddiff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.javaindex 51e43c75842..679cd2e777e 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java@@ -74,6 +74,7 @@ import org.apache.lucene.index.FieldFilterLeafReader;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.Fields;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader.ReaderClosedListener;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriter;@@ -1339,7 +1340,7 @@ public abstract class LuceneTestCase extends Assert {/** Returns a FieldType derived from newType but whose* term vector options match the old type */private static FieldType mergeTermVectorOptions(FieldType newType, FieldType oldType) {- if (newType.indexOptions() != null && oldType.storeTermVectors() == true && newType.storeTermVectors() == false) {+ if (newType.indexOptions() != IndexOptions.NO && oldType.storeTermVectors() == true && newType.storeTermVectors() == false) {newType = new FieldType(newType);newType.setStoreTermVectors(oldType.storeTermVectors());newType.setStoreTermVectorPositions(oldType.storeTermVectorPositions());@@ -1364,7 +1365,7 @@ public abstract class LuceneTestCase extends Assert {FieldType prevType = fieldToType.get(name);- if (usually(random) || type.indexOptions() == null || prevType != null) {+ if (usually(random) || type.indexOptions() == IndexOptions.NO || prevType != null) {// most of the time, don't modify the paramsif (prevType == null) {fieldToType.put(name, new FieldType(type));diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.javaindex 9cf4ec3a1f4..323c4347192 100644--- a/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java+++ b/lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java@@ -62,17 +62,17 @@ import org.apache.lucene.document.IntField;import org.apache.lucene.document.LongField;import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.document.SortedDocValuesField;-import org.apache.lucene.index.FilterLeafReader;-import org.apache.lucene.index.LeafReader;-import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.CheckIndex;import org.apache.lucene.index.ConcurrentMergeScheduler;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.DocsAndPositionsEnum;import org.apache.lucene.index.DocsEnum;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.FilterLeafReader;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.IndexWriter;import org.apache.lucene.index.IndexableField;+import org.apache.lucene.index.LeafReader;+import org.apache.lucene.index.LeafReaderContext;import org.apache.lucene.index.LogMergePolicy;import org.apache.lucene.index.MergePolicy;import org.apache.lucene.index.MergeScheduler;@@ -82,14 +82,13 @@ import org.apache.lucene.index.Terms;import org.apache.lucene.index.TermsEnum;import org.apache.lucene.index.TieredMergePolicy;import org.apache.lucene.search.FieldDoc;-import org.apache.lucene.search.FilteredQuery;import org.apache.lucene.search.FilteredQuery.FilterStrategy;+import org.apache.lucene.search.FilteredQuery;import org.apache.lucene.search.ScoreDoc;import org.apache.lucene.search.TopDocs;import org.apache.lucene.store.Directory;import org.apache.lucene.store.NoLockFactory;import org.junit.Assert;-import com.carrotsearch.randomizedtesting.generators.RandomInts;import com.carrotsearch.randomizedtesting.generators.RandomPicks;@@ -890,14 +889,14 @@ public final class TestUtil {final Field field2;final DocValuesType dvType = field1.fieldType().docValueType();final NumericType numType = field1.fieldType().numericType();- if (dvType != null) {+ if (dvType != DocValuesType.NO) {switch(dvType) {case NUMERIC:field2 = new NumericDocValuesField(field1.name(), field1.numericValue().longValue());break;case BINARY:field2 = new BinaryDocValuesField(field1.name(), field1.binaryValue());- break;+ break;case SORTED:field2 = new SortedDocValuesField(field1.name(), field1.binaryValue());break;diff --git a/lucene/tools/javadoc/ecj.javadocs.prefs b/lucene/tools/javadoc/ecj.javadocs.prefsindex b7398861cc4..8a01bdd379d 100644--- a/lucene/tools/javadoc/ecj.javadocs.prefs+++ b/lucene/tools/javadoc/ecj.javadocs.prefs@@ -1,5 +1,10 @@#Sun Sep 23 20:55:03 EDT 2012eclipse.preferences.version=1+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault+org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabledorg.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7org.eclipse.jdt.core.compiler.compliance=1.7org.eclipse.jdt.core.compiler.doc.comment.support=enableddiff --git a/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.javaindex eff88895660..65cf1ef86ca 100644--- a/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java+++ b/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java@@ -28,7 +28,8 @@ import org.apache.lucene.analysis.util.TokenFilterFactory;import org.apache.lucene.analysis.util.TokenizerFactory;import org.apache.lucene.document.Field;import org.apache.lucene.index.*;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.DocValuesType;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.search.DocIdSetIterator;import org.apache.lucene.search.similarities.Similarity;import org.apache.lucene.store.Directory;@@ -56,9 +57,9 @@ import org.apache.solr.search.SolrIndexSearcher;import org.slf4j.Logger;import org.slf4j.LoggerFactory;-import static org.apache.lucene.index.FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;-import static org.apache.lucene.index.FieldInfo.IndexOptions.DOCS_AND_FREQS;-import static org.apache.lucene.index.FieldInfo.IndexOptions.DOCS_ONLY;+import static org.apache.lucene.index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;+import static org.apache.lucene.index.IndexOptions.DOCS_AND_FREQS;+import static org.apache.lucene.index.IndexOptions.DOCS;/*** This handler exposes the internal lucene index. It is inspired by and@@ -176,17 +177,17 @@ public class LukeRequestHandler extends RequestHandlerBaseStringBuilder flags = new StringBuilder();- flags.append( (f != null && f.fieldType().indexOptions() != null) ? FieldFlag.INDEXED.getAbbreviation() : '-' );+ flags.append( (f != null && f.fieldType().indexOptions() != IndexOptions.NO) ? FieldFlag.INDEXED.getAbbreviation() : '-' );flags.append( (f != null && f.fieldType().tokenized()) ? FieldFlag.TOKENIZED.getAbbreviation() : '-' );flags.append( (f != null && f.fieldType().stored()) ? FieldFlag.STORED.getAbbreviation() : '-' );- flags.append( (f != null && f.fieldType().docValueType() != null) ? FieldFlag.DOC_VALUES.getAbbreviation() : "-" );+ flags.append( (f != null && f.fieldType().docValueType() != DocValuesType.NO) ? FieldFlag.DOC_VALUES.getAbbreviation() : "-" );flags.append( (false) ? FieldFlag.MULTI_VALUED.getAbbreviation() : '-' ); // SchemaField Specificflags.append( (f != null && f.fieldType().storeTermVectors()) ? FieldFlag.TERM_VECTOR_STORED.getAbbreviation() : '-' );flags.append( (f != null && f.fieldType().storeTermVectorOffsets()) ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-' );flags.append( (f != null && f.fieldType().storeTermVectorPositions()) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation() : '-' );flags.append( (f != null && f.fieldType().omitNorms()) ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-' );- flags.append( (f != null && DOCS_ONLY == opts ) ?+ flags.append( (f != null && DOCS == opts ) ?FieldFlag.OMIT_TF.getAbbreviation() : '-' );flags.append((f != null && DOCS_AND_FREQS == opts) ?diff --git a/solr/core/src/java/org/apache/solr/schema/BBoxField.java b/solr/core/src/java/org/apache/solr/schema/BBoxField.javaindex 422b35f89b6..fa32215109f 100644--- a/solr/core/src/java/org/apache/solr/schema/BBoxField.java+++ b/solr/core/src/java/org/apache/solr/schema/BBoxField.java@@ -18,7 +18,7 @@ package org.apache.solr.schema;*/import com.spatial4j.core.shape.Rectangle;-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.queries.function.ValueSource;import org.apache.lucene.spatial.bbox.BBoxOverlapRatioValueSource;import org.apache.lucene.spatial.bbox.BBoxStrategy;@@ -103,7 +103,7 @@ public class BBoxField extends AbstractSpatialFieldType<BBoxStrategy> implements//and annoyingly this field isn't going to have a docValues format because Solr uses a separate Field for thatif (field.hasDocValues()) {luceneType = new org.apache.lucene.document.FieldType(luceneType);- luceneType.setDocValueType(FieldInfo.DocValuesType.NUMERIC);+ luceneType.setDocValueType(DocValuesType.NUMERIC);}strategy.setFieldType(luceneType);return strategy;diff --git a/solr/core/src/java/org/apache/solr/schema/EnumField.java b/solr/core/src/java/org/apache/solr/schema/EnumField.javaindex febc7fc685c..6a107f1e388 100644--- a/solr/core/src/java/org/apache/solr/schema/EnumField.java+++ b/solr/core/src/java/org/apache/solr/schema/EnumField.java@@ -18,6 +18,7 @@ package org.apache.solr.schema;*/import org.apache.lucene.document.FieldType;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.StorableField;import org.apache.lucene.queries.function.ValueSource;import org.apache.lucene.queries.function.valuesource.EnumFieldSource;@@ -384,7 +385,7 @@ public class EnumField extends PrimitiveFieldType {newType.setTokenized(field.isTokenized());newType.setStored(field.stored());newType.setOmitNorms(field.omitNorms());- newType.setIndexOptions(field.indexed() ? getIndexOptions(field, intAsString) : null);+ newType.setIndexOptions(field.indexed() ? getIndexOptions(field, intAsString) : IndexOptions.NO);newType.setStoreTermVectors(field.storeTermVector());newType.setStoreTermVectorOffsets(field.storeTermOffsets());newType.setStoreTermVectorPositions(field.storeTermPositions());diff --git a/solr/core/src/java/org/apache/solr/schema/FieldType.java b/solr/core/src/java/org/apache/solr/schema/FieldType.javaindex 32100817339..437ce96c8f9 100644--- a/solr/core/src/java/org/apache/solr/schema/FieldType.java+++ b/solr/core/src/java/org/apache/solr/schema/FieldType.java@@ -25,7 +25,7 @@ import org.apache.lucene.analysis.util.CharFilterFactory;import org.apache.lucene.analysis.util.TokenFilterFactory;import org.apache.lucene.analysis.util.TokenizerFactory;import org.apache.lucene.document.Field;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.StorableField;import org.apache.lucene.index.Term;import org.apache.lucene.queries.function.ValueSource;@@ -268,7 +268,7 @@ public abstract class FieldType extends FieldProperties {newType.setTokenized(field.isTokenized());newType.setStored(field.stored());newType.setOmitNorms(field.omitNorms());- newType.setIndexOptions(field.indexed() ? getIndexOptions(field, val) : null);+ newType.setIndexOptions(field.indexed() ? getIndexOptions(field, val) : IndexOptions.NO);newType.setStoreTermVectors(field.storeTermVector());newType.setStoreTermVectorOffsets(field.storeTermOffsets());newType.setStoreTermVectorPositions(field.storeTermPositions());@@ -316,7 +316,7 @@ public abstract class FieldType extends FieldProperties {IndexOptions options = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;if (field.omitTermFreqAndPositions()) {- options = IndexOptions.DOCS_ONLY;+ options = IndexOptions.DOCS;} else if (field.omitPositions()) {options = IndexOptions.DOCS_AND_FREQS;} else if (field.storeOffsetsWithPositions()) {diff --git a/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java b/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.javaindex 6f9cd9fb5c8..25c47cbc226 100644--- a/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java+++ b/solr/core/src/java/org/apache/solr/schema/PreAnalyzedField.java@@ -29,7 +29,7 @@ import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.analysis.Tokenizer;import org.apache.lucene.document.Field;import org.apache.lucene.index.StorableField;-import org.apache.lucene.index.FieldInfo.IndexOptions;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.queries.function.ValueSource;import org.apache.lucene.queries.function.valuesource.SortedSetFieldSource;import org.apache.lucene.search.SortField;@@ -168,7 +168,7 @@ public class PreAnalyzedField extends FieldType {newType.setOmitNorms(field.omitNorms());IndexOptions options = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;if (field.omitTermFreqAndPositions()) {- options = IndexOptions.DOCS_ONLY;+ options = IndexOptions.DOCS;} else if (field.omitPositions()) {options = IndexOptions.DOCS_AND_FREQS;} else if (field.storeOffsetsWithPositions()) {@@ -250,7 +250,7 @@ public class PreAnalyzedField extends FieldType {}} else {if (f != null) {- f.fieldType().setIndexOptions(null);+ f.fieldType().setIndexOptions(IndexOptions.NO);f.fieldType().setTokenized(false);}}diff --git a/solr/core/src/java/org/apache/solr/schema/TrieField.java b/solr/core/src/java/org/apache/solr/schema/TrieField.javaindex f62e5610087..f26e98e0518 100644--- a/solr/core/src/java/org/apache/solr/schema/TrieField.java+++ b/solr/core/src/java/org/apache/solr/schema/TrieField.java@@ -32,6 +32,7 @@ import org.apache.lucene.document.IntField;import org.apache.lucene.document.LongField;import org.apache.lucene.document.NumericDocValuesField;import org.apache.lucene.document.SortedSetDocValuesField;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.StorableField;import org.apache.lucene.queries.function.ValueSource;import org.apache.lucene.queries.function.valuesource.DoubleFieldSource;@@ -601,7 +602,7 @@ public class TrieField extends PrimitiveFieldType {ft.setStored(stored);ft.setTokenized(true);ft.setOmitNorms(field.omitNorms());- ft.setIndexOptions(indexed ? getIndexOptions(field, value.toString()) : null);+ ft.setIndexOptions(indexed ? getIndexOptions(field, value.toString()) : IndexOptions.NO);switch (type) {case INTEGER:diff --git a/solr/core/src/java/org/apache/solr/search/Insanity.java b/solr/core/src/java/org/apache/solr/search/Insanity.javaindex fd55ffd4509..d4d528b80fc 100644--- a/solr/core/src/java/org/apache/solr/search/Insanity.java+++ b/solr/core/src/java/org/apache/solr/search/Insanity.java@@ -24,6 +24,7 @@ import java.util.Collections;import org.apache.lucene.index.FilterLeafReader;import org.apache.lucene.index.LeafReader;import org.apache.lucene.index.BinaryDocValues;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfo;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.NumericDocValues;@@ -65,7 +66,7 @@ public class Insanity {for (FieldInfo fi : in.getFieldInfos()) {if (fi.name.equals(insaneField)) {filteredInfos.add(new FieldInfo(fi.name, fi.number, fi.hasVectors(), fi.omitsNorms(),- fi.hasPayloads(), fi.getIndexOptions(), null, -1, null));+ fi.hasPayloads(), fi.getIndexOptions(), DocValuesType.NO, -1, null));} else {filteredInfos.add(fi);}diff --git a/solr/core/src/test/org/apache/solr/schema/DocValuesMultiTest.java b/solr/core/src/test/org/apache/solr/schema/DocValuesMultiTest.javaindex 40d665976db..26474d96908 100644--- a/solr/core/src/test/org/apache/solr/schema/DocValuesMultiTest.java+++ b/solr/core/src/test/org/apache/solr/schema/DocValuesMultiTest.java@@ -18,7 +18,7 @@ package org.apache.solr.schema;*/import org.apache.lucene.index.LeafReader;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.index.SortedSetDocValues;import org.apache.solr.SolrTestCaseJ4;diff --git a/solr/core/src/test/org/apache/solr/schema/DocValuesTest.java b/solr/core/src/test/org/apache/solr/schema/DocValuesTest.javaindex 3fc9f48a6a8..298bdc2f74a 100644--- a/solr/core/src/test/org/apache/solr/schema/DocValuesTest.java+++ b/solr/core/src/test/org/apache/solr/schema/DocValuesTest.java@@ -18,7 +18,7 @@ package org.apache.solr.schema;*/import org.apache.lucene.index.LeafReader;-import org.apache.lucene.index.FieldInfo.DocValuesType;+import org.apache.lucene.index.DocValuesType;import org.apache.lucene.index.FieldInfos;import org.apache.lucene.queries.function.FunctionValues;import org.apache.solr.SolrTestCaseJ4;diff --git a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java b/solr/core/src/test/org/apache/solr/search/TestStressLucene.javaindex 3920a277921..9f95ee3ee1e 100644--- a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java+++ b/solr/core/src/test/org/apache/solr/search/TestStressLucene.java@@ -22,7 +22,7 @@ import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;import org.apache.lucene.document.FieldType;import org.apache.lucene.index.DirectoryReader;-import org.apache.lucene.index.FieldInfo;+import org.apache.lucene.index.IndexOptions;import org.apache.lucene.index.IndexReader;import org.apache.lucene.index.RandomIndexWriter;import org.apache.lucene.index.StoredDocument;@@ -86,7 +86,7 @@ public class TestStressLucene extends TestRTGBase {idFt.setStored(true);idFt.setOmitNorms(true);idFt.setTokenized(false);- idFt.setIndexOptions(FieldInfo.IndexOptions.DOCS_ONLY);+ idFt.setIndexOptions(IndexOptions.DOCS);final FieldType ft2 = new FieldType();ft2.setStored(true);