lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [06/33] lucenenet git commit: Lucene.Net.Index.IndexOptions refactor: Added a NONE option and refactored all types that use IndexOptions to use NONE instead of null.
Date Fri, 17 Mar 2017 22:28:36 GMT
Lucene.Net.Index.IndexOptions refactor: Added a NONE option and refactored all types that use IndexOptions to use NONE instead of null.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/a4d90fa3
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/a4d90fa3
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/a4d90fa3

Branch: refs/heads/api-work
Commit: a4d90fa37bf1f9ec2abe02b92288dfdad87b3eba
Parents: bd5b34d
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Mar 17 00:40:15 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Mar 17 00:40:15 2017 +0700

----------------------------------------------------------------------
 .../BlockTerms/BlockTermsReader.cs              |  8 +-
 .../Memory/DirectPostingsFormat.cs              | 52 +++++------
 .../Memory/FSTOrdTermsReader.cs                 |  6 +-
 src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs  |  6 +-
 .../Memory/MemoryPostingsFormat.cs              | 18 ++--
 .../Pulsing/PulsingPostingsReader.cs            | 13 ++-
 .../Pulsing/PulsingPostingsWriter.cs            | 75 ++++++++--------
 src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs  |  2 +-
 src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs  |  4 +-
 src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs  |  4 +-
 src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs  |  4 +-
 .../SimpleText/SimpleTextFieldInfosReader.cs    |  4 +-
 .../SimpleText/SimpleTextFieldInfosWriter.cs    |  6 +-
 .../SimpleText/SimpleTextFieldsReader.cs        | 15 ++--
 .../SimpleText/SimpleTextFieldsWriter.cs        |  2 +-
 .../Codecs/BlockTreeTermsReader.cs              | 10 +--
 .../Codecs/Lucene3x/Lucene3xFieldInfosReader.cs |  4 +-
 .../Codecs/Lucene3x/Lucene3xFields.cs           |  6 +-
 .../Codecs/Lucene3x/SegmentTermDocs.cs          |  2 +-
 .../Codecs/Lucene40/Lucene40FieldInfosReader.cs |  2 +-
 .../Codecs/Lucene40/Lucene40PostingsReader.cs   | 10 +--
 .../Codecs/Lucene41/Lucene41PostingsReader.cs   | 33 ++++---
 .../Codecs/Lucene41/Lucene41PostingsWriter.cs   |  8 +-
 .../Codecs/Lucene42/Lucene42FieldInfosReader.cs |  2 +-
 .../Codecs/Lucene46/Lucene46FieldInfosReader.cs |  2 +-
 .../Codecs/Lucene46/Lucene46FieldInfosWriter.cs |  4 +-
 src/Lucene.Net.Core/Codecs/PostingsConsumer.cs  |  2 +-
 src/Lucene.Net.Core/Codecs/TermsConsumer.cs     |  2 +-
 src/Lucene.Net.Core/Document/FieldType.cs       |  9 +-
 src/Lucene.Net.Core/Index/CheckIndex.cs         |  8 +-
 src/Lucene.Net.Core/Index/FieldInfo.cs          | 63 ++++++++------
 src/Lucene.Net.Core/Index/FieldInfos.cs         |  6 +-
 .../Index/FreqProxTermsWriterPerField.cs        | 20 ++---
 .../PostingsHighlight/PostingsHighlighter.cs    |  1 -
 .../Index/Sorter/SortingAtomicReader.cs         |  2 +-
 .../Codecs/Asserting/AssertingPostingsFormat.cs |  2 +-
 .../Lucene3x/PreFlexRWFieldInfosReader.cs       |  4 +-
 .../Codecs/Lucene3x/PreFlexRWFieldsWriter.cs    |  2 +-
 .../Codecs/Lucene40/Lucene40FieldInfosWriter.cs |  4 +-
 .../Codecs/Lucene40/Lucene40PostingsWriter.cs   | 10 +--
 .../Codecs/Lucene42/Lucene42FieldInfosWriter.cs |  4 +-
 .../Codecs/RAMOnly/RAMOnlyPostingsFormat.cs     |  8 +-
 .../Index/BasePostingsFormatTestCase.cs         | 90 +++++++++++++++-----
 .../Codecs/Lucene41/TestBlockPostingsFormat2.cs |  6 ++
 44 files changed, 306 insertions(+), 239 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs b/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
index 891fca0..fe6e2d0 100644
--- a/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
+++ b/src/Lucene.Net.Codecs/BlockTerms/BlockTermsReader.cs
@@ -304,17 +304,17 @@ namespace Lucene.Net.Codecs.BlockTerms
 
             public override bool HasFreqs
             {
-                get { return _fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS; }
+                get { return _fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return _fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS; }
+                get { return _fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return _fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
+                get { return _fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
             }
 
             public override bool HasPayloads
@@ -761,7 +761,7 @@ namespace Lucene.Net.Codecs.BlockTerms
                 public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse,
                     DocsAndPositionsFlags flags)
                 {
-                    if (_fieldReader._fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
+                    if (_fieldReader._fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
                     {
                         // Positions were not indexed:
                         return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
index bf3acc8..f1728f4 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
@@ -348,8 +348,8 @@ namespace Lucene.Net.Codecs.Memory
             internal readonly TermAndSkip[] terms;
             private readonly bool hasFreq;
             private readonly bool hasPos;
-            private readonly bool hasOffsets_Renamed;
-            private readonly bool hasPayloads_Renamed;
+            private readonly bool hasOffsets;
+            private readonly bool hasPayloads;
             private readonly long sumTotalTermFreq;
             private readonly int docCount;
             private readonly long sumDocFreq;
@@ -407,10 +407,10 @@ namespace Lucene.Net.Codecs.Memory
 
                 this.minSkipCount = minSkipCount;
 
-                hasFreq = fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_ONLY) > 0;
-                hasPos = fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS) > 0;
-                hasOffsets_Renamed = fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) > 0;
-                hasPayloads_Renamed = fieldInfo.HasPayloads;
+                hasFreq = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_ONLY) > 0;
+                hasPos = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) > 0;
+                hasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) > 0;
+                hasPayloads = fieldInfo.HasPayloads;
 
                 BytesRef term;
                 DocsEnum docsEnum = null;
@@ -480,12 +480,12 @@ namespace Lucene.Net.Codecs.Memory
                                     for (int pos = 0; pos < freq; pos++)
                                     {
                                         scratch.Add(docsAndPositionsEnum.NextPosition());
-                                        if (hasOffsets_Renamed)
+                                        if (hasOffsets)
                                         {
                                             scratch.Add(docsAndPositionsEnum.StartOffset);
                                             scratch.Add(docsAndPositionsEnum.EndOffset);
                                         }
-                                        if (hasPayloads_Renamed)
+                                        if (hasPayloads)
                                         {
                                             BytesRef payload = docsAndPositionsEnum.GetPayload();
                                             if (payload != null)
@@ -505,7 +505,7 @@ namespace Lucene.Net.Codecs.Memory
 
 
                         byte[] payloads;
-                        if (hasPayloads_Renamed)
+                        if (hasPayloads)
                         {
                             ros.Flush();
                             payloads = new byte[(int) ros.Length];
@@ -533,7 +533,7 @@ namespace Lucene.Net.Codecs.Memory
                             if (hasPos)
                             {
                                 positions = new int[docFreq][];
-                                if (hasPayloads_Renamed)
+                                if (hasPayloads)
                                 {
                                     payloads = new byte[docFreq][][];
                                 }
@@ -568,7 +568,7 @@ namespace Lucene.Net.Codecs.Memory
                                 if (hasPos)
                                 {
                                     int mult;
-                                    if (hasOffsets_Renamed)
+                                    if (hasOffsets)
                                     {
                                         mult = 3;
                                     }
@@ -576,7 +576,7 @@ namespace Lucene.Net.Codecs.Memory
                                     {
                                         mult = 1;
                                     }
-                                    if (hasPayloads_Renamed)
+                                    if (hasPayloads)
                                     {
                                         payloads[upto] = new byte[freq][];
                                     }
@@ -585,7 +585,7 @@ namespace Lucene.Net.Codecs.Memory
                                     for (int pos = 0; pos < freq; pos++)
                                     {
                                         positions[upto][posUpto] = docsAndPositionsEnum.NextPosition();
-                                        if (hasPayloads_Renamed)
+                                        if (hasPayloads)
                                         {
                                             BytesRef payload = docsAndPositionsEnum.GetPayload();
                                             if (payload != null)
@@ -597,7 +597,7 @@ namespace Lucene.Net.Codecs.Memory
                                             }
                                         }
                                         posUpto++;
-                                        if (hasOffsets_Renamed)
+                                        if (hasOffsets)
                                         {
                                             positions[upto][posUpto++] = docsAndPositionsEnum.StartOffset;
                                             positions[upto][posUpto++] = docsAndPositionsEnum.EndOffset;
@@ -865,7 +865,7 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasOffsets
             {
-                get { return hasOffsets_Renamed; }
+                get { return hasOffsets; }
             }
 
             public override bool HasPositions
@@ -875,7 +875,7 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasPayloads
             {
-                get { return hasPayloads_Renamed; }
+                get { return hasPayloads; }
             }
 
             private sealed class DirectTermsEnum : TermsEnum
@@ -1077,7 +1077,7 @@ namespace Lucene.Net.Codecs.Memory
                             if (outerInstance.hasPos)
                             {
                                 int posLen;
-                                if (outerInstance.hasOffsets_Renamed)
+                                if (outerInstance.hasOffsets)
                                 {
                                     posLen = 3;
                                 }
@@ -1085,7 +1085,7 @@ namespace Lucene.Net.Codecs.Memory
                                 {
                                     posLen = 1;
                                 }
-                                if (outerInstance.hasPayloads_Renamed)
+                                if (outerInstance.hasPayloads)
                                 {
                                     posLen++;
                                 }
@@ -1183,13 +1183,13 @@ namespace Lucene.Net.Codecs.Memory
                         int[] postings = term.Postings;
                         byte[] payloads = term.Payloads;
                         return
-                            (new LowFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets_Renamed,
-                                outerInstance.hasPayloads_Renamed)).Reset(postings, payloads);
+                            (new LowFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets,
+                                outerInstance.hasPayloads)).Reset(postings, payloads);
                     }
                     else
                     {   HighFreqTerm term = (HighFreqTerm) outerInstance.terms[termOrd];
                         return
-                            (new HighFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets_Renamed)).Reset(
+                            (new HighFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets)).Reset(
                                 term.DocIDs, term.Freqs, term.Positions, term.Payloads);
                     }
                 }
@@ -1783,7 +1783,7 @@ namespace Lucene.Net.Codecs.Memory
                             if (outerInstance.hasPos)
                             {
                                 int posLen;
-                                if (outerInstance.hasOffsets_Renamed)
+                                if (outerInstance.hasOffsets)
                                 {
                                     posLen = 3;
                                 }
@@ -1791,7 +1791,7 @@ namespace Lucene.Net.Codecs.Memory
                                 {
                                     posLen = 1;
                                 }
-                                if (outerInstance.hasPayloads_Renamed)
+                                if (outerInstance.hasPayloads)
                                 {
                                     posLen++;
                                 }
@@ -1832,14 +1832,14 @@ namespace Lucene.Net.Codecs.Memory
                         int[] postings = term.Postings;
                         byte[] payloads = term.Payloads;
                         return
-                            (new LowFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets_Renamed,
-                                outerInstance.hasPayloads_Renamed)).Reset(postings, payloads);
+                            (new LowFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets,
+                                outerInstance.hasPayloads)).Reset(postings, payloads);
                     }
                     else
                     {
                         HighFreqTerm term = (HighFreqTerm) outerInstance.terms[termOrd];
                         return
-                            (new HighFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets_Renamed)).Reset(
+                            (new HighFreqDocsAndPositionsEnum(liveDocs, outerInstance.hasOffsets)).Reset(
                                 term.DocIDs, term.Freqs, term.Positions, term.Payloads);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
index b14cfbd..4ed56b5 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
@@ -254,17 +254,17 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasFreqs
             {
-                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
index e06cd85..2bc04be 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
@@ -222,17 +222,17 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasFreqs
             {
-                get{ return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
index 5bbc72e..8e2b773 100644
--- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
@@ -199,7 +199,7 @@ namespace Lucene.Net.Codecs.Memory
                         buffer.WriteVInt32(delta);
                     }
 
-                    if (outerInstance.field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
+                    if (outerInstance.field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
                     {
                         // don't use startOffset - lastEndOffset, because this creates lots of negative vints for synonyms,
                         // and the numbers aren't that much smaller anyways.
@@ -831,14 +831,14 @@ namespace Lucene.Net.Codecs.Memory
 
                 if (reuse == null || !(reuse is FSTDocsEnum))
                 {
-                    docsEnum = new FSTDocsEnum(field.IndexOptions.Value, field.HasPayloads);
+                    docsEnum = new FSTDocsEnum(field.IndexOptions, field.HasPayloads);
                 }
                 else
                 {
                     docsEnum = (FSTDocsEnum)reuse;
-                    if (!docsEnum.CanReuse(field.IndexOptions.Value, field.HasPayloads))
+                    if (!docsEnum.CanReuse(field.IndexOptions, field.HasPayloads))
                     {
-                        docsEnum = new FSTDocsEnum(field.IndexOptions.Value, field.HasPayloads);
+                        docsEnum = new FSTDocsEnum(field.IndexOptions, field.HasPayloads);
                     }
                 }
                 return docsEnum.Reset(this.postingsSpare, liveDocs, docFreq_Renamed);
@@ -846,8 +846,8 @@ namespace Lucene.Net.Codecs.Memory
 
             public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
             {
-                bool hasOffsets = field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
-                if (field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
+                bool hasOffsets = field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+                if (field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
                 {
                     return null;
                 }
@@ -1003,17 +1003,17 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasFreqs
             {
-                get { return field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
+                get { return field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
+                get { return field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
+                get { return field.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
index 2949420..65afb9b 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
@@ -175,7 +175,7 @@ namespace Lucene.Net.Codecs.Pulsing
             termState2.Absolute = termState2.Absolute || absolute;
             // if we have positions, its total TF, otherwise its computed based on docFreq.
             // TODO Double check this is right..
-            long count = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS.CompareTo(fieldInfo.IndexOptions) <= 0
+            long count = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS.CompareTo(fieldInfo.IndexOptions) >= 0
                 ? termState2.TotalTermFreq
                 : termState2.DocFreq;
            
@@ -317,7 +317,7 @@ namespace Lucene.Net.Codecs.Pulsing
         {
             private byte[] _postingsBytes;
             private readonly ByteArrayDataInput _postings = new ByteArrayDataInput();
-            private readonly IndexOptions? _indexOptions;
+            private readonly IndexOptions _indexOptions;
             private readonly bool _storePayloads;
             private readonly bool _storeOffsets;
             private IBits _liveDocs;
@@ -332,7 +332,7 @@ namespace Lucene.Net.Codecs.Pulsing
             {
                 _indexOptions = fieldInfo.IndexOptions;
                 _storePayloads = fieldInfo.HasPayloads;
-                _storeOffsets = _indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+                _storeOffsets = _indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             }
 
             public virtual PulsingDocsEnum Reset(IBits liveDocs, PulsingTermState termState)
@@ -382,7 +382,7 @@ namespace Lucene.Net.Codecs.Pulsing
                         _accum += (int)((uint)code >> 1); ; // shift off low bit
                         _freq = (code & 1) != 0 ? 1 : _postings.ReadVInt32();
 
-                        if (_indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
+                        if (_indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
                         {
                             // Skip positions
                             if (_storePayloads)
@@ -455,7 +455,7 @@ namespace Lucene.Net.Codecs.Pulsing
             private readonly bool _storeOffsets;
             // note: we could actually reuse across different options, if we passed this to reset()
             // and re-init'ed storeOffsets accordingly (made it non-final)
-            private readonly IndexOptions? _indexOptions;
+            private readonly IndexOptions _indexOptions;
 
             private IBits _liveDocs;
             private int _docId = -1;
@@ -475,8 +475,7 @@ namespace Lucene.Net.Codecs.Pulsing
             {
                 _indexOptions = fieldInfo.IndexOptions;
                 _storePayloads = fieldInfo.HasPayloads;
-                _storeOffsets =
-                    _indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+                _storeOffsets = _indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             }
 
             internal bool CanReuse(FieldInfo fieldInfo)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
index c045e33..d33fd72 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs
@@ -43,7 +43,7 @@ namespace Lucene.Net.Codecs.Pulsing
     {
         internal static readonly string CODEC = "PulsedPostingsWriter";
         internal static readonly string SUMMARY_EXTENSION = "smy";         // recording field summary
-        
+
         // To add a new version, increment from the last one, and
         // change VERSION_CURRENT to point to your new version:
         internal static readonly int VERSION_START = 0;
@@ -53,7 +53,7 @@ namespace Lucene.Net.Codecs.Pulsing
         private readonly SegmentWriteState _segmentState;
         private IndexOutput _termsOut;
         private readonly List<FieldMetaData> _fields;
-        private IndexOptions? _indexOptions;
+        private IndexOptions _indexOptions;
         private bool _storePayloads;
 
         // information for wrapped PF, in current field
@@ -143,7 +143,7 @@ namespace Lucene.Net.Codecs.Pulsing
 
         public override BlockTermState NewTermState()
         {
-            var state = new PulsingTermState {wrappedState = _wrappedPostingsWriter.NewTermState()};
+            var state = new PulsingTermState { wrappedState = _wrappedPostingsWriter.NewTermState() };
             return state;
         }
 
@@ -266,7 +266,7 @@ namespace Lucene.Net.Codecs.Pulsing
         /// <param name="state"></param>
         public override void FinishTerm(BlockTermState state)
         {
-            var state2 = (PulsingTermState) state;
+            var state2 = (PulsingTermState)state;
 
             Debug.Assert(_pendingCount > 0 || _pendingCount == -1);
 
@@ -289,7 +289,7 @@ namespace Lucene.Net.Codecs.Pulsing
                 // given codec wants to store other interesting
                 // stuff, it could use this pulsing codec to do so
 
-                if (_indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+                if (_indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
                 {
                     var lastDocID = 0;
                     var pendingIDX = 0;
@@ -322,7 +322,7 @@ namespace Lucene.Net.Codecs.Pulsing
                             Debug.Assert(pos.docID == doc.docID);
                             var posDelta = pos.pos - lastPos;
                             lastPos = pos.pos;
-                            
+
                             var payloadLength = pos.payload == null ? 0 : pos.payload.Length;
                             if (_storePayloads)
                             {
@@ -342,7 +342,7 @@ namespace Lucene.Net.Codecs.Pulsing
                                 _buffer.WriteVInt32(posDelta);
                             }
 
-                            if (_indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
+                            if (_indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
                             {
                                 //System.out.println("write=" + pos.startOffset + "," + pos.endOffset);
                                 var offsetDelta = pos.startOffset - lastOffset;
@@ -368,45 +368,40 @@ namespace Lucene.Net.Codecs.Pulsing
                         }
                     }
                 }
-                else switch (_indexOptions)
+                else if (_indexOptions == IndexOptions.DOCS_AND_FREQS)
                 {
-                    case IndexOptions.DOCS_AND_FREQS:
+                    int lastDocId = 0;
+                    for (int posIdx = 0; posIdx < _pendingCount; posIdx++)
                     {
-                        var lastDocId = 0;
-                        for (var posIdx = 0; posIdx < _pendingCount; posIdx++)
-                        {
-                            var doc = _pending[posIdx];
-                            var delta = doc.docID - lastDocId;
+                        Position doc = _pending[posIdx];
+                        int delta = doc.docID - lastDocId;
 
-                            Debug.Assert(doc.termFreq != 0);
+                        Debug.Assert(doc.termFreq != 0);
 
-                            if (doc.termFreq == 1)
-                            {
-                                _buffer.WriteVInt32((delta << 1) | 1);
-                            }
-                            else
-                            {
-                                _buffer.WriteVInt32(delta << 1);
-                                _buffer.WriteVInt32(doc.termFreq);
-                            }
-                            lastDocId = doc.docID;
+                        if (doc.termFreq == 1)
+                        {
+                            _buffer.WriteVInt32((delta << 1) | 1);
                         }
-                    }
-                        break;
-                    case IndexOptions.DOCS_ONLY:
-                    {
-                        var lastDocId = 0;
-                        for (var posIdx = 0; posIdx < _pendingCount; posIdx++)
+                        else
                         {
-                            var doc = _pending[posIdx];
-                            _buffer.WriteVInt32(doc.docID - lastDocId);
-                            lastDocId = doc.docID;
+                            _buffer.WriteVInt32(delta << 1);
+                            _buffer.WriteVInt32(doc.termFreq);
                         }
+                        lastDocId = doc.docID;
+                    }
+                }
+                else if (_indexOptions == IndexOptions.DOCS_ONLY)
+                {
+                    int lastDocId = 0;
+                    for (int posIdx = 0; posIdx < _pendingCount; posIdx++)
+                    {
+                        Position doc = _pending[posIdx];
+                        _buffer.WriteVInt32(doc.docID - lastDocId);
+                        lastDocId = doc.docID;
                     }
-                        break;
                 }
 
-                state2.bytes = new byte[(int) _buffer.FilePointer];
+                state2.bytes = new byte[(int)_buffer.FilePointer];
                 _buffer.WriteTo(state2.bytes, 0);
                 _buffer.Reset();
             }
@@ -416,7 +411,7 @@ namespace Lucene.Net.Codecs.Pulsing
         public override void EncodeTerm(long[] empty, DataOutput output, FieldInfo fieldInfo, BlockTermState state,
             bool abs)
         {
-            var _state = (PulsingTermState) state;
+            var _state = (PulsingTermState)state;
             Debug.Assert(empty.Length == 0);
             _absolute = _absolute || abs;
             if (_state.bytes == null)
@@ -478,11 +473,11 @@ namespace Lucene.Net.Codecs.Pulsing
             _wrappedPostingsWriter.StartTerm();
 
             // Flush all buffered docs
-            if (_indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+            if (_indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
             {
                 Position doc = null;
 
-                foreach(var pos in _pending)
+                foreach (var pos in _pending)
                 {
                     if (doc == null)
                     {
@@ -502,7 +497,7 @@ namespace Lucene.Net.Codecs.Pulsing
             }
             else
             {
-                foreach(var doc in _pending)
+                foreach (var doc in _pending)
                 {
                     _wrappedPostingsWriter.StartDoc(doc.docID, _indexOptions == IndexOptions.DOCS_ONLY ? 0 : doc.termFreq);
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs b/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
index d305642..d7c7047 100644
--- a/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs
@@ -313,7 +313,7 @@ namespace Lucene.Net.Codecs.Sep
 
             // TODO: -- should we do omitTF with 2 different enum classes?
             private bool _omitTf;
-            private IndexOptions? _indexOptions;
+            private IndexOptions _indexOptions;
             private bool _storePayloads;
             private IBits _liveDocs;
             private readonly Int32IndexInput.AbstractReader _docReader;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs b/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs
index f54d201..9692d64 100644
--- a/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs
+++ b/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs
@@ -82,7 +82,7 @@ namespace Lucene.Net.Codecs.Sep
         internal readonly int totalNumDocs;
 
         internal bool storePayloads;
-        internal IndexOptions? indexOptions; 
+        internal IndexOptions indexOptions; 
 
         internal FieldInfo fieldInfo;
 
@@ -195,7 +195,7 @@ namespace Lucene.Net.Codecs.Sep
             
             indexOptions = fieldInfo.IndexOptions;
 
-            if (indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
+            if (indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0)
             {
                 throw new System.NotSupportedException("this codec cannot index offsets");
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs b/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs
index dd0dff8..a25c223 100644
--- a/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs
+++ b/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs
@@ -83,9 +83,9 @@ namespace Lucene.Net.Codecs.Sep
             _lastPosIndex = posIn != null ? posIn.GetIndex() : null;
         }
 
-        private IndexOptions? _indexOptions;
+        private IndexOptions _indexOptions;
 
-        internal virtual void SetIndexOptions(IndexOptions? v)
+        internal virtual void SetIndexOptions(IndexOptions v)
         {
             _indexOptions = v;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs b/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs
index a9eb542..4bff5b8 100644
--- a/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs
+++ b/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs
@@ -85,9 +85,9 @@ namespace Lucene.Net.Codecs.Sep
             }
         }
 
-        private IndexOptions? _indexOptions;
+        private IndexOptions _indexOptions;
 
-        internal virtual void SetIndexOptions(IndexOptions? v)
+        internal virtual void SetIndexOptions(IndexOptions v)
         {
             _indexOptions = v;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
index 1d8fe3e..6b91c73 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
@@ -74,7 +74,7 @@ namespace Lucene.Net.Codecs.SimpleText
                     Debug.Assert(StringHelper.StartsWith(scratch, SimpleTextFieldInfosWriter.ISINDEXED));
                     bool isIndexed = Convert.ToBoolean(ReadString(SimpleTextFieldInfosWriter.ISINDEXED.Length, scratch));
 
-                    IndexOptions? indexOptions;
+                    IndexOptions indexOptions;
                     if (isIndexed)
                     {
                         SimpleTextUtil.ReadLine(input, scratch);
@@ -84,7 +84,7 @@ namespace Lucene.Net.Codecs.SimpleText
                     }
                     else
                     {
-                        indexOptions = null;
+                        indexOptions = IndexOptions.NONE;
                     }
 
                     SimpleTextUtil.ReadLine(input, scratch);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosWriter.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosWriter.cs
index 84dd56e..3be7043 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosWriter.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosWriter.cs
@@ -91,9 +91,11 @@ namespace Lucene.Net.Codecs.SimpleText
 
                     if (fi.IsIndexed)
                     {
-                        Debug.Assert(fi.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS || !fi.HasPayloads);
+                        Debug.Assert(fi.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.HasPayloads);
                         SimpleTextUtil.Write(output, INDEXOPTIONS);
-                        SimpleTextUtil.Write(output, fi.IndexOptions.ToString(), scratch);
+                        SimpleTextUtil.Write(output, 
+                            fi.IndexOptions != IndexOptions.NONE ? fi.IndexOptions.ToString() : string.Empty, 
+                            scratch);
                         SimpleTextUtil.WriteNewline(output);
                     }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
index 9ba8af8..5c62585 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
@@ -111,16 +111,15 @@ namespace Lucene.Net.Codecs.SimpleText
         {
             private readonly SimpleTextFieldsReader _outerInstance;
 
-            private readonly IndexOptions? _indexOptions;
+            private readonly IndexOptions _indexOptions;
             private int _docFreq;
             private long _totalTermFreq;
             private long _docsStart;
             
             private readonly BytesRefFSTEnum<PairOutputs<long?, PairOutputs<long?,long?>.Pair>.Pair> _fstEnum;
 
-            [ExceptionToNullableEnumConvention]
             public SimpleTextTermsEnum(SimpleTextFieldsReader outerInstance,
-                FST<PairOutputs<long?, PairOutputs<long?,long?>.Pair>.Pair> fst, IndexOptions? indexOptions)
+                FST<PairOutputs<long?, PairOutputs<long?,long?>.Pair>.Pair> fst, IndexOptions indexOptions)
             {
                 _outerInstance = outerInstance;
                 _indexOptions = indexOptions;
@@ -215,7 +214,7 @@ namespace Lucene.Net.Codecs.SimpleText
             public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
             {
 
-                if (_indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
+                if (_indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
                 {
                     // Positions were not indexed
                     return null;
@@ -230,7 +229,7 @@ namespace Lucene.Net.Codecs.SimpleText
                 {
                     docsAndPositionsEnum = new SimpleTextDocsAndPositionsEnum(_outerInstance);
                 }
-                return docsAndPositionsEnum.Reset(_docsStart, liveDocs, _indexOptions.GetValueOrDefault(), _docFreq);
+                return docsAndPositionsEnum.Reset(_docsStart, liveDocs, _indexOptions, _docFreq);
             }
 
             public override IComparer<BytesRef> Comparer
@@ -712,20 +711,20 @@ namespace Lucene.Net.Codecs.SimpleText
 
             public override bool HasFreqs
             {
-                get { return _fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
+                get { return _fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
             }
 
             public override bool HasOffsets
             {
                 get
                 {
-                    return _fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
+                    return _fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                 }
             }
 
             public override bool HasPositions
             {
-                get { return _fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; } 
+                get { return _fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; } 
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsWriter.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsWriter.cs
index 0cffcce..e82e3a4 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsWriter.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsWriter.cs
@@ -118,7 +118,7 @@ namespace Lucene.Net.Codecs.SimpleText
             public SimpleTextPostingsWriter(SimpleTextFieldsWriter outerInstance, FieldInfo field)
             {
                 _outerInstance = outerInstance;
-                _indexOptions = field.IndexOptions.Value;
+                _indexOptions = field.IndexOptions;
                 _writePositions = _indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
                 _writeOffsets = _indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
index 2ef4809..674c073 100644
--- a/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/BlockTreeTermsReader.cs
@@ -613,17 +613,17 @@ namespace Lucene.Net.Codecs
 
             public override bool HasFreqs
             {
-                get { return fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
             }
 
             public override bool HasPayloads
@@ -1196,7 +1196,7 @@ namespace Lucene.Net.Codecs
 
                 public override DocsAndPositionsEnum DocsAndPositions(IBits skipDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
                 {
-                    if (outerInstance.fieldInfo.IndexOptions < IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+                    if (outerInstance.fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
                     {
                         // Positions were not indexed:
                         return null;
@@ -2621,7 +2621,7 @@ namespace Lucene.Net.Codecs
 
                 public override DocsAndPositionsEnum DocsAndPositions(IBits skipDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
                 {
-                    if (outerInstance.fieldInfo.IndexOptions < IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+                    if (outerInstance.fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
                     {
                         // Positions were not indexed:
                         return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFieldInfosReader.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFieldInfosReader.cs
index b3e3933..3bd2044 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFieldInfosReader.cs
@@ -92,7 +92,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                     IndexOptions indexOptions;
                     if (!isIndexed)
                     {
-                        indexOptions = default(IndexOptions);
+                        indexOptions = IndexOptions.NONE;
                     }
                     else if ((bits & OMIT_TERM_FREQ_AND_POSITIONS) != 0)
                     {
@@ -123,7 +123,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                     }
                     infos[i] = new FieldInfo(name, isIndexed, fieldNumber, storeTermVector, 
                         omitNorms, storePayloads, indexOptions, null, 
-                        isIndexed && !omitNorms ? DocValuesType.NUMERIC : default(DocValuesType), 
+                        isIndexed && !omitNorms ? DocValuesType.NUMERIC : default(DocValuesType), // LUCENENET TODO: Bug.. default is not null
                         Collections.EmptyMap<string, string>());
                 }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
index c10113a..0a09879 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFields.cs
@@ -266,7 +266,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
             public override bool HasFreqs
             {
-                get { return fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0; }
             }
 
             public override bool HasOffsets
@@ -274,14 +274,14 @@ namespace Lucene.Net.Codecs.Lucene3x
                 get
                 {
                     // preflex doesn't support this
-                    Debug.Assert(fieldInfo.IndexOptions < IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
+                    Debug.Assert(fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) < 0);
                     return false;
                 }
             }
 
             public override bool HasPositions
             {
-                get { return fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
+                get { return fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0; }
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermDocs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermDocs.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermDocs.cs
index ae409c3..9c0b3eb 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermDocs.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/SegmentTermDocs.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Codecs.Lucene3x
         private bool haveSkipped;
 
         protected bool m_currentFieldStoresPayloads;
-        protected IndexOptions? m_indexOptions;
+        protected IndexOptions m_indexOptions;
 
         public SegmentTermDocs(IndexInput freqStream, TermInfosReader tis, FieldInfos fieldInfos)
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
index 7eb152c..f6f3a04 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
@@ -72,7 +72,7 @@ namespace Lucene.Net.Codecs.Lucene40
                     IndexOptions indexOptions;
                     if (!isIndexed)
                     {
-                        indexOptions = default(IndexOptions);
+                        indexOptions = IndexOptions.NONE;
                     }
                     else if ((bits & Lucene40FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS) != 0)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
index dcc74be..d53ebd4 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
@@ -206,7 +206,7 @@ namespace Lucene.Net.Codecs.Lucene40
                 // undefined
             }
 
-            if (fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+            if (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
             {
                 termState2.proxOffset += @in.ReadVInt64();
                 // if (DEBUG) System.out.println("  proxFP=" + termState2.proxOffset);
@@ -254,7 +254,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         public override DocsAndPositionsEnum DocsAndPositions(FieldInfo fieldInfo, BlockTermState termState, IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
         {
-            bool hasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+            bool hasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
 
             // TODO: can we optimize if FLAG_PAYLOADS / FLAG_OFFSETS
             // isn't passed?
@@ -347,7 +347,7 @@ namespace Lucene.Net.Codecs.Lucene40
             {
                 m_indexOmitsTF = fieldInfo.IndexOptions == IndexOptions.DOCS_ONLY;
                 m_storePayloads = fieldInfo.HasPayloads;
-                m_storeOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                m_storeOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                 m_freqOffset = termState.freqOffset;
                 m_skipOffset = termState.skipOffset;
 
@@ -1019,9 +1019,9 @@ namespace Lucene.Net.Codecs.Lucene40
 
             public virtual SegmentFullPositionsEnum Reset(FieldInfo fieldInfo, StandardTermState termState, IBits liveDocs)
             {
-                storeOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                storeOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                 storePayloads = fieldInfo.HasPayloads;
-                Debug.Assert(fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
+                Debug.Assert(fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0);
                 Debug.Assert(storePayloads || storeOffsets);
                 if (payload == null)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
index 4da641a..e7b5f84 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsReader.cs
@@ -138,8 +138,8 @@ namespace Lucene.Net.Codecs.Lucene41
         public override void DecodeTerm(long[] longs, DataInput @in, FieldInfo fieldInfo, BlockTermState termState, bool absolute)
         {
             Lucene41PostingsWriter.Int32BlockTermState termState2 = (Lucene41PostingsWriter.Int32BlockTermState)termState;
-            bool fieldHasPositions = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
-            bool fieldHasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+            bool fieldHasPositions = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+            bool fieldHasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             bool fieldHasPayloads = fieldInfo.HasPayloads;
 
             if (absolute)
@@ -193,8 +193,8 @@ namespace Lucene.Net.Codecs.Lucene41
 
         private void DecodeTerm(DataInput @in, FieldInfo fieldInfo, Lucene41PostingsWriter.Int32BlockTermState termState)
         {
-            bool fieldHasPositions = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
-            bool fieldHasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+            bool fieldHasPositions = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+            bool fieldHasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             bool fieldHasPayloads = fieldInfo.HasPayloads;
             if (termState.DocFreq == 1)
             {
@@ -253,7 +253,7 @@ namespace Lucene.Net.Codecs.Lucene41
 
         public override DocsAndPositionsEnum DocsAndPositions(FieldInfo fieldInfo, BlockTermState termState, IBits liveDocs, DocsAndPositionsEnum reuse, DocsAndPositionsFlags flags)
         {
-            bool indexHasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+            bool indexHasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             bool indexHasPayloads = fieldInfo.HasPayloads;
 
             if ((!indexHasOffsets || (flags & DocsAndPositionsFlags.OFFSETS) == 0) && (!indexHasPayloads || (flags & DocsAndPositionsFlags.PAYLOADS) == 0))
@@ -343,16 +343,19 @@ namespace Lucene.Net.Codecs.Lucene41
                 this.outerInstance = outerInstance;
                 this.startDocIn = outerInstance.docIn;
                 this.docIn = null;
-                indexHasFreq = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS;
-                indexHasPos = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
-                indexHasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                indexHasFreq = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
+                indexHasPos = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+                indexHasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                 indexHasPayloads = fieldInfo.HasPayloads;
                 encoded = new byte[ForUtil.MAX_ENCODED_SIZE];
             }
 
             public bool CanReuse(IndexInput docIn, FieldInfo fieldInfo)
             {
-                return docIn == startDocIn && indexHasFreq == (fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS) && indexHasPos == (fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) && indexHasPayloads == fieldInfo.HasPayloads;
+                return docIn == startDocIn && 
+                    indexHasFreq == (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0) && 
+                    indexHasPos == (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) && 
+                    indexHasPayloads == fieldInfo.HasPayloads;
             }
 
             public DocsEnum Reset(IBits liveDocs, Lucene41PostingsWriter.Int32BlockTermState termState, DocsFlags flags)
@@ -668,13 +671,15 @@ namespace Lucene.Net.Codecs.Lucene41
                 this.docIn = null;
                 this.posIn = (IndexInput)outerInstance.posIn.Clone();
                 encoded = new byte[ForUtil.MAX_ENCODED_SIZE];
-                indexHasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                indexHasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                 indexHasPayloads = fieldInfo.HasPayloads;
             }
 
             public bool CanReuse(IndexInput docIn, FieldInfo fieldInfo)
             {
-                return docIn == startDocIn && indexHasOffsets == (fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) && indexHasPayloads == fieldInfo.HasPayloads;
+                return docIn == startDocIn && 
+                    indexHasOffsets == (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) 
+                    && indexHasPayloads == fieldInfo.HasPayloads;
             }
 
             public DocsAndPositionsEnum Reset(IBits liveDocs, Lucene41PostingsWriter.Int32BlockTermState termState)
@@ -1154,7 +1159,7 @@ namespace Lucene.Net.Codecs.Lucene41
                 this.posIn = (IndexInput)outerInstance.posIn.Clone();
                 this.payIn = (IndexInput)outerInstance.payIn.Clone();
                 encoded = new byte[ForUtil.MAX_ENCODED_SIZE];
-                indexHasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                indexHasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                 if (indexHasOffsets)
                 {
                     offsetStartDeltaBuffer = new int[ForUtil.MAX_DATA_SIZE];
@@ -1185,7 +1190,9 @@ namespace Lucene.Net.Codecs.Lucene41
 
             public bool CanReuse(IndexInput docIn, FieldInfo fieldInfo)
             {
-                return docIn == startDocIn && indexHasOffsets == (fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) && indexHasPayloads == fieldInfo.HasPayloads;
+                return docIn == startDocIn && 
+                    indexHasOffsets == (fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) && 
+                    indexHasPayloads == fieldInfo.HasPayloads;
             }
 
             public EverythingEnum Reset(IBits liveDocs, Lucene41PostingsWriter.Int32BlockTermState termState, DocsAndPositionsFlags flags)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsWriter.cs
index 9c8af79..60732d7 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene41/Lucene41PostingsWriter.cs
@@ -246,10 +246,10 @@ namespace Lucene.Net.Codecs.Lucene41
 
         public override int SetField(FieldInfo fieldInfo)
         {
-            IndexOptions? indexOptions = fieldInfo.IndexOptions;
-            fieldHasFreqs = indexOptions >= IndexOptions.DOCS_AND_FREQS;
-            fieldHasPositions = indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
-            fieldHasOffsets = indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+            IndexOptions indexOptions = fieldInfo.IndexOptions;
+            fieldHasFreqs = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
+            fieldHasPositions = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+            fieldHasOffsets = indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
             fieldHasPayloads = fieldInfo.HasPayloads;
             skipWriter.SetField(fieldHasPositions, fieldHasOffsets, fieldHasPayloads);
             lastState = emptyState;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42FieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42FieldInfosReader.cs b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42FieldInfosReader.cs
index b50c075..5229c37 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42FieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42FieldInfosReader.cs
@@ -74,7 +74,7 @@ namespace Lucene.Net.Codecs.Lucene42
                     IndexOptions indexOptions;
                     if (!isIndexed)
                     {
-                        indexOptions = default(IndexOptions);
+                        indexOptions = IndexOptions.NONE;
                     }
                     else if ((bits & Lucene42FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS) != 0)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
index 63f4c94..19d3685 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
@@ -70,7 +70,7 @@ namespace Lucene.Net.Codecs.Lucene46
                     IndexOptions indexOptions;
                     if (!isIndexed)
                     {
-                        indexOptions = default(IndexOptions);
+                        indexOptions = IndexOptions.NONE;
                     }
                     else if ((bits & Lucene46FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS) != 0)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
index df803b1..7af8cf8 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Codecs.Lucene46
                 output.WriteVInt32(infos.Count);
                 foreach (FieldInfo fi in infos)
                 {
-                    IndexOptions? indexOptions = fi.IndexOptions;
+                    IndexOptions indexOptions = fi.IndexOptions;
                     sbyte bits = 0x0;
                     if (fi.HasVectors)
                     {
@@ -71,7 +71,7 @@ namespace Lucene.Net.Codecs.Lucene46
                     if (fi.IsIndexed)
                     {
                         bits |= Lucene46FieldInfosFormat.IS_INDEXED;
-                        Debug.Assert(indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS || !fi.HasPayloads);
+                        Debug.Assert(indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !fi.HasPayloads);
                         if (indexOptions == IndexOptions.DOCS_ONLY)
                         {
                             bits |= Lucene46FieldInfosFormat.OMIT_TERM_FREQ_AND_POSITIONS;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs b/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
index 3fc91e1..b8615a7 100644
--- a/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/PostingsConsumer.cs
@@ -84,7 +84,7 @@ namespace Lucene.Net.Codecs
         /// Default merge impl: append documents, mapping around
         ///  deletes
         /// </summary>
-        public virtual TermStats Merge(MergeState mergeState, IndexOptions? indexOptions, DocsEnum postings, FixedBitSet visitedDocs)
+        public virtual TermStats Merge(MergeState mergeState, IndexOptions indexOptions, DocsEnum postings, FixedBitSet visitedDocs)
         {
             int df = 0;
             long totTF = 0;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Codecs/TermsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/TermsConsumer.cs b/src/Lucene.Net.Core/Codecs/TermsConsumer.cs
index 511feb4..ca896bf 100644
--- a/src/Lucene.Net.Core/Codecs/TermsConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/TermsConsumer.cs
@@ -95,7 +95,7 @@ namespace Lucene.Net.Codecs
 
         /// <summary>
         /// Default merge impl </summary>
-        public virtual void Merge(MergeState mergeState, IndexOptions? indexOptions, TermsEnum termsEnum)
+        public virtual void Merge(MergeState mergeState, IndexOptions indexOptions, TermsEnum termsEnum)
         {
             BytesRef term;
             Debug.Assert(termsEnum != null);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Document/FieldType.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Document/FieldType.cs b/src/Lucene.Net.Core/Document/FieldType.cs
index c751227..d6850fd 100644
--- a/src/Lucene.Net.Core/Document/FieldType.cs
+++ b/src/Lucene.Net.Core/Document/FieldType.cs
@@ -37,7 +37,7 @@ namespace Lucene.Net.Documents
         private bool storeTermVectorPositions;
         private bool storeTermVectorPayloads;
         private bool omitNorms;
-        private IndexOptions? indexOptions = Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+        private IndexOptions indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
         private NumericType? numericType;
         private bool frozen;
         private int numericPrecisionStep = NumericUtils.PRECISION_STEP_DEFAULT;
@@ -235,7 +235,7 @@ namespace Lucene.Net.Documents
         /// </summary>
         /// <exception cref="InvalidOperationException"> if this <see cref="FieldType"/> is frozen against
         ///         future modifications. </exception>
-        public virtual IndexOptions? IndexOptions
+        public virtual IndexOptions IndexOptions
         {
             get
             {
@@ -335,10 +335,11 @@ namespace Lucene.Net.Documents
                 {
                     result.Append(",omitNorms");
                 }
-                if (indexOptions != Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+                if (indexOptions != IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
                 {
                     result.Append(",indexOptions=");
-                    result.Append(indexOptions);
+                    // LUCENENET: duplcate what would happen if you print a null indexOptions in Java
+                    result.Append(indexOptions != IndexOptions.NONE ? indexOptions.ToString() : string.Empty);
                 }
                 if (numericType != null)
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Index/CheckIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/CheckIndex.cs b/src/Lucene.Net.Core/Index/CheckIndex.cs
index 27b33dc..1f1f999 100644
--- a/src/Lucene.Net.Core/Index/CheckIndex.cs
+++ b/src/Lucene.Net.Core/Index/CheckIndex.cs
@@ -1048,7 +1048,7 @@ namespace Lucene.Net.Index
                 bool hasOffsets = terms.HasOffsets;
 
                 // term vectors cannot omit TF:
-                bool expectedHasFreqs = (isVectors || fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS);
+                bool expectedHasFreqs = (isVectors || fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0);
 
                 if (hasFreqs != expectedHasFreqs)
                 {
@@ -1065,7 +1065,7 @@ namespace Lucene.Net.Index
 
                 if (!isVectors)
                 {
-                    bool expectedHasPositions = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+                    bool expectedHasPositions = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
                     if (hasPositions != expectedHasPositions)
                     {
                         throw new Exception("field \"" + field + "\" should have hasPositions=" + expectedHasPositions + " but got " + hasPositions);
@@ -1077,7 +1077,7 @@ namespace Lucene.Net.Index
                         throw new Exception("field \"" + field + "\" should have hasPayloads=" + expectedHasPayloads + " but got " + hasPayloads);
                     }
 
-                    bool expectedHasOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                    bool expectedHasOffsets = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                     if (hasOffsets != expectedHasOffsets)
                     {
                         throw new Exception("field \"" + field + "\" should have hasOffsets=" + expectedHasOffsets + " but got " + hasOffsets);
@@ -2134,7 +2134,7 @@ namespace Lucene.Net.Index
                             {
                                 Terms terms = tfv.GetTerms(field);
                                 termsEnum = terms.GetIterator(termsEnum);
-                                bool postingsHasFreq = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS;
+                                bool postingsHasFreq = fieldInfo.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
                                 bool postingsHasPayload = fieldInfo.HasPayloads;
                                 bool vectorsHasPayload = terms.HasPayloads;
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Index/FieldInfo.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/FieldInfo.cs b/src/Lucene.Net.Core/Index/FieldInfo.cs
index 19c8c95..873980d 100644
--- a/src/Lucene.Net.Core/Index/FieldInfo.cs
+++ b/src/Lucene.Net.Core/Index/FieldInfo.cs
@@ -45,9 +45,9 @@ namespace Lucene.Net.Index
         // True if any document indexed term vectors
         private bool storeTermVector;
 
-        private DocValuesType? normTypeValue;
+        private DocValuesType? normType;
         private bool omitNorms; // omit norms associated with indexed fields
-        private IndexOptions? indexOptionsValue;
+        private IndexOptions indexOptions;
         private bool storePayloads; // whether this field stores payloads together with term positions
 
         private IDictionary<string, string> attributes;
@@ -62,7 +62,7 @@ namespace Lucene.Net.Index
         /// @lucene.experimental
         /// </summary>
         public FieldInfo(string name, bool indexed, int number, bool storeTermVector, bool omitNorms, 
-            bool storePayloads, IndexOptions? indexOptions, DocValuesType? docValues, DocValuesType? normsType, 
+            bool storePayloads, IndexOptions indexOptions, DocValuesType? docValues, DocValuesType? normsType, 
             IDictionary<string, string> attributes)
         {
             this.Name = name;
@@ -74,16 +74,16 @@ namespace Lucene.Net.Index
                 this.storeTermVector = storeTermVector;
                 this.storePayloads = storePayloads;
                 this.omitNorms = omitNorms;
-                this.indexOptionsValue = indexOptions;
-                this.normTypeValue = !omitNorms ? normsType : null;
+                this.indexOptions = indexOptions;
+                this.normType = !omitNorms ? normsType : null;
             } // for non-indexed fields, leave defaults
             else
             {
                 this.storeTermVector = false;
                 this.storePayloads = false;
                 this.omitNorms = false;
-                this.indexOptionsValue = null;
-                this.normTypeValue = null;
+                this.indexOptions = IndexOptions.NONE;
+                this.normType = null;
             }
             this.attributes = attributes;
             Debug.Assert(CheckConsistency());
@@ -96,18 +96,18 @@ namespace Lucene.Net.Index
                 Debug.Assert(!storeTermVector);
                 Debug.Assert(!storePayloads);
                 Debug.Assert(!omitNorms);
-                Debug.Assert(normTypeValue == null);
-                Debug.Assert(indexOptionsValue == null);
+                Debug.Assert(normType == null);
+                Debug.Assert(indexOptions == IndexOptions.NONE);
             }
             else
             {
-                Debug.Assert(indexOptionsValue != null);
+                Debug.Assert(indexOptions != IndexOptions.NONE);
                 if (omitNorms)
                 {
-                    Debug.Assert(normTypeValue == null);
+                    Debug.Assert(normType == null);
                 }
                 // Cannot store payloads unless positions are indexed:
-                Debug.Assert(((int)indexOptionsValue.GetValueOrDefault() >= (int)Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) || !this.storePayloads);
+                Debug.Assert(indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 || !this.storePayloads);
             }
 
             return true;
@@ -119,7 +119,7 @@ namespace Lucene.Net.Index
         }
 
         // should only be called by FieldInfos#addOrUpdate
-        internal void Update(bool indexed, bool storeTermVector, bool omitNorms, bool storePayloads, IndexOptions? indexOptions)
+        internal void Update(bool indexed, bool storeTermVector, bool omitNorms, bool storePayloads, IndexOptions indexOptions)
         {
             //System.out.println("FI.update field=" + name + " indexed=" + indexed + " omitNorms=" + omitNorms + " this.omitNorms=" + this.omitNorms);
             if (this.indexed != indexed)
@@ -139,20 +139,20 @@ namespace Lucene.Net.Index
                 if (this.omitNorms != omitNorms)
                 {
                     this.omitNorms = true; // if one require omitNorms at least once, it remains off for life
-                    this.normTypeValue = null;
+                    this.normType = null;
                 }
-                if (this.indexOptionsValue != indexOptions)
+                if (this.indexOptions != indexOptions)
                 {
-                    if (this.indexOptionsValue == null)
+                    if (this.indexOptions == IndexOptions.NONE)
                     {
-                        this.indexOptionsValue = indexOptions;
+                        this.indexOptions = indexOptions;
                     }
                     else
                     {
                         // downgrade
-                        indexOptionsValue = (int)indexOptionsValue.GetValueOrDefault() < (int)indexOptions ? indexOptionsValue : indexOptions;
+                        this.indexOptions = this.indexOptions.CompareTo(indexOptions) < 0 ? this.indexOptions : indexOptions;
                     }
-                    if ((int)indexOptionsValue.GetValueOrDefault() < (int)Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+                    if (this.indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) < 0)
                     {
                         // cannot store payloads if we don't store positions:
                         this.storePayloads = false;
@@ -181,11 +181,11 @@ namespace Lucene.Net.Index
 
         /// <summary>
         /// Returns IndexOptions for the field, or null if the field is not indexed </summary>
-        public IndexOptions? IndexOptions
+        public IndexOptions IndexOptions
         {
             get
             {
-                return indexOptionsValue;
+                return indexOptions;
             }
         }
 
@@ -218,15 +218,15 @@ namespace Lucene.Net.Index
         {
             get
             {
-                return normTypeValue;
+                return normType;
             }
             internal set
             {
-                if (normTypeValue != null && normTypeValue != value)
+                if (normType != null && normType != value)
                 {
-                    throw new System.ArgumentException("cannot change Norm type from " + normTypeValue + " to " + value + " for field \"" + Name + "\"");
+                    throw new System.ArgumentException("cannot change Norm type from " + normType + " to " + value + " for field \"" + Name + "\"");
                 }
-                normTypeValue = value;
+                normType = value;
                 Debug.Assert(CheckConsistency());
             }
         }
@@ -239,7 +239,7 @@ namespace Lucene.Net.Index
 
         internal void SetStorePayloads()
         {
-            if (indexed && (int)indexOptionsValue.GetValueOrDefault() >= (int)Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
+            if (indexed && indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0)
             {
                 storePayloads = true;
             }
@@ -259,7 +259,7 @@ namespace Lucene.Net.Index
         /// </summary>
         public bool HasNorms
         {
-            get { return normTypeValue != null; }
+            get { return normType != null; }
         }
 
         /// <summary>
@@ -352,6 +352,15 @@ namespace Lucene.Net.Index
         // NOTE: order is important here; FieldInfo uses this
         // order to merge two conflicting IndexOptions (always
         // "downgrades" by picking the lowest).
+
+        /// <summary>
+        /// No index options will be used.
+        /// <para/>
+        /// NOTE: This is the same as setting to <c>null</c> in Lucene
+        /// </summary>
+        // LUCENENET specific
+        NONE,
+
         /// <summary>
         /// Only documents are indexed: term frequencies and positions are omitted.
         /// Phrase and other positional queries on the field will throw an exception, and scoring

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Index/FieldInfos.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/FieldInfos.cs b/src/Lucene.Net.Core/Index/FieldInfos.cs
index 6881fc6..19d1acc 100644
--- a/src/Lucene.Net.Core/Index/FieldInfos.cs
+++ b/src/Lucene.Net.Core/Index/FieldInfos.cs
@@ -78,9 +78,9 @@ namespace Lucene.Net.Index
                 byName[info.Name] = info;
 
                 hasVectors |= info.HasVectors;
-                hasProx |= info.IsIndexed && info.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+                hasProx |= info.IsIndexed && info.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
                 hasFreq |= info.IsIndexed && info.IndexOptions != IndexOptions.DOCS_ONLY;
-                hasOffsets |= info.IsIndexed && info.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                hasOffsets |= info.IsIndexed && info.IndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
                 hasNorms |= info.HasNorms;
                 hasDocValues |= info.HasDocValues;
                 hasPayloads |= info.HasPayloads;
@@ -381,7 +381,7 @@ namespace Lucene.Net.Index
                 return AddOrUpdateInternal(name, -1, fieldType.IsIndexed, false, fieldType.OmitNorms, false, fieldType.IndexOptions, fieldType.DocValueType, null);
             }
 
-            private FieldInfo AddOrUpdateInternal(string name, int preferredFieldNumber, bool isIndexed, bool storeTermVector, bool omitNorms, bool storePayloads, IndexOptions? indexOptions, DocValuesType? docValues, DocValuesType? normType)
+            private FieldInfo AddOrUpdateInternal(string name, int preferredFieldNumber, bool isIndexed, bool storeTermVector, bool omitNorms, bool storePayloads, IndexOptions indexOptions, DocValuesType? docValues, DocValuesType? normType)
             {
                 FieldInfo fi = FieldInfo(name);
                 if (fi == null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs b/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs
index 44f5e2e..1217fed 100644
--- a/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs
+++ b/src/Lucene.Net.Core/Index/FreqProxTermsWriterPerField.cs
@@ -103,18 +103,18 @@ namespace Lucene.Net.Index
             payloadAttribute = null;
         }
 
-        private void SetIndexOptions(IndexOptions? indexOptions)
+        private void SetIndexOptions(IndexOptions indexOptions)
         {
-            if (indexOptions == null)
+            if (indexOptions == IndexOptions.NONE)
             {
                 // field could later be updated with indexed=true, so set everything on
                 hasFreq = hasProx = hasOffsets = true;
             }
             else
             {
-                hasFreq = indexOptions >= Index.IndexOptions.DOCS_AND_FREQS;
-                hasProx = indexOptions >= Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
-                hasOffsets = indexOptions >= Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                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;
             }
         }
 
@@ -412,12 +412,12 @@ namespace Lucene.Net.Index
             // according to this.indexOptions, but then write the
             // new segment to the directory according to
             // currentFieldIndexOptions:
-            IndexOptions? currentFieldIndexOptions = fieldInfo.IndexOptions;
-            Debug.Assert(currentFieldIndexOptions != null);
+            IndexOptions currentFieldIndexOptions = fieldInfo.IndexOptions;
+            Debug.Assert(currentFieldIndexOptions != IndexOptions.NONE);
 
-            bool writeTermFreq = currentFieldIndexOptions >= Index.IndexOptions.DOCS_AND_FREQS;
-            bool writePositions = currentFieldIndexOptions >= Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
-            bool writeOffsets = currentFieldIndexOptions >= Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+            bool writeTermFreq = currentFieldIndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS) >= 0;
+            bool writePositions = currentFieldIndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0;
+            bool writeOffsets = currentFieldIndexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
 
             bool readTermFreq = this.hasFreq;
             bool readPositions = this.hasProx;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
index 3056fc0..8cb7f24 100644
--- a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
+++ b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs
@@ -10,7 +10,6 @@ using System.Globalization;
 using System.IO;
 using System.Linq;
 using System.Text;
-using IndexOptions = Lucene.Net.Index.IndexOptions;
 
 namespace Lucene.Net.Search.PostingsHighlight
 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a4d90fa3/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
index 00584dc..894193f 100644
--- a/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
+++ b/src/Lucene.Net.Misc/Index/Sorter/SortingAtomicReader.cs
@@ -66,7 +66,7 @@ namespace Lucene.Net.Index.Sorter
                 }
                 else
                 {
-                    return new SortingTerms(terms, infos.FieldInfo(field).IndexOptions.GetValueOrDefault(), docMap);
+                    return new SortingTerms(terms, infos.FieldInfo(field).IndexOptions, docMap);
                 }
             }
         }


Mime
View raw message