Lucene.Net.Core.Documents.DocValueType refactor: Added NONE option and 
refactored all types that use DocValuesType 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/0169d4aa
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/0169d4aa
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/0169d4aa

Branch: refs/heads/api-work
Commit: 0169d4aaf976cd48a3a8822f7edfbc3c9b1ff119
Parents: 7e4a7bb
Author: Shad Storhaug <[email protected]>
Authored: Fri Mar 17 06:28:56 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Fri Mar 17 07:45:57 2017 +0700

----------------------------------------------------------------------
 .../SimpleText/SimpleTextFieldInfosReader.cs    |   9 +-
 .../SimpleText/SimpleTextFieldInfosWriter.cs    |   5 +-
 .../Codecs/Lucene3x/Lucene3xFieldInfosReader.cs |   4 +-
 .../Codecs/Lucene40/Lucene40DocValuesReader.cs  |   8 +-
 .../Codecs/Lucene40/Lucene40FieldInfosReader.cs | 167 +++++++------------
 .../Codecs/Lucene42/Lucene42FieldInfosReader.cs |   8 +-
 .../Codecs/Lucene46/Lucene46FieldInfosReader.cs |   8 +-
 .../Codecs/Lucene46/Lucene46FieldInfosWriter.cs |   4 +-
 src/Lucene.Net.Core/Document/FieldType.cs       |  10 +-
 src/Lucene.Net.Core/Index/DocValuesProcessor.cs |   4 +-
 src/Lucene.Net.Core/Index/FieldInfo.cs          |  52 +++---
 src/Lucene.Net.Core/Index/FieldInfos.cs         |  34 ++--
 src/Lucene.Net.Core/Index/IndexableFieldType.cs |   8 +-
 src/Lucene.Net.Core/Index/NormsConsumer.cs      |   2 +-
 src/Lucene.Net.Core/Index/SegmentMerger.cs      |   4 +-
 src/Lucene.Net.Core/Index/SegmentReader.cs      |   6 +-
 src/Lucene.Net.Memory/MemoryIndex.cs            |  11 +-
 .../Asserting/AssertingDocValuesFormat.cs       |   2 +-
 .../Lucene3x/PreFlexRWFieldInfosReader.cs       |  17 +-
 .../Lucene3x/PreFlexRWFieldInfosWriter.cs       |   2 +-
 .../Codecs/Lucene40/Lucene40DocValuesWriter.cs  |  22 +--
 .../Codecs/Lucene40/Lucene40FieldInfosWriter.cs |   8 +-
 .../Codecs/Lucene42/Lucene42FieldInfosWriter.cs |   4 +-
 .../Index/BasePostingsFormatTestCase.cs         |   6 +-
 src/Lucene.Net.TestFramework/Util/TestUtil.cs   |   4 +-
 .../AllGroupHeadsCollectorTest.cs               |   3 +-
 .../DistinctValuesCollectorTest.cs              |  24 +--
 .../Function/TestDocValuesFieldSources.cs       |   2 +-
 src/Lucene.Net.Tests/Index/TestCodecs.cs        |   4 +-
 .../Index/TestIndexableField.cs                 |   4 +-
 30 files changed, 211 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 6b91c73..4842751 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosReader.cs
@@ -104,12 +104,12 @@ namespace Lucene.Net.Codecs.SimpleText
                     SimpleTextUtil.ReadLine(input, scratch);
                     Debug.Assert(StringHelper.StartsWith(scratch, 
SimpleTextFieldInfosWriter.NORMS_TYPE));
                     string nrmType = 
ReadString(SimpleTextFieldInfosWriter.NORMS_TYPE.Length, scratch);
-                    Index.DocValuesType? normsType = DocValuesType(nrmType);
+                    Index.DocValuesType normsType = DocValuesType(nrmType);
 
                     SimpleTextUtil.ReadLine(input, scratch);
                     Debug.Assert(StringHelper.StartsWith(scratch, 
SimpleTextFieldInfosWriter.DOCVALUES));
                     string dvType = 
ReadString(SimpleTextFieldInfosWriter.DOCVALUES.Length, scratch);
-                    Index.DocValuesType? docValuesType = DocValuesType(dvType);
+                    Index.DocValuesType docValuesType = DocValuesType(dvType);
 
                     SimpleTextUtil.ReadLine(input, scratch);
                     Debug.Assert(StringHelper.StartsWith(scratch, 
SimpleTextFieldInfosWriter.DOCVALUES_GEN));
@@ -158,10 +158,9 @@ namespace Lucene.Net.Codecs.SimpleText
             }
         }
 
-        [ExceptionToNullableEnumConvention]
-        public virtual Index.DocValuesType? DocValuesType(string dvType)
+        public virtual Index.DocValuesType DocValuesType(string dvType)
         {
-            return "false".Equals(dvType) ? null : 
(Index.DocValuesType?)Enum.Parse(typeof(Index.DocValuesType), dvType, true);
+            return "false".Equals(dvType) ? Index.DocValuesType.NONE : 
(Index.DocValuesType)Enum.Parse(typeof(Index.DocValuesType), dvType, true);
         }
 
         private string ReadString(int offset, BytesRef scratch)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 3be7043..75979c8 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosWriter.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldInfosWriter.cs
@@ -157,9 +157,10 @@ namespace Lucene.Net.Codecs.SimpleText
             }
         }
 
-        private static string GetDocValuesType(DocValuesType? type)
+        private static string GetDocValuesType(DocValuesType type)
         {
-            return type.HasValue ? type.ToString() : "false";
+            // LUCENENET specific - need to write false for NONE
+            return type != DocValuesType.NONE ? type.ToString() : "false";
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 3bd2044..c6cbf4c 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xFieldInfosReader.cs
@@ -122,8 +122,8 @@ namespace Lucene.Net.Codecs.Lucene3x
                         storePayloads = false;
                     }
                     infos[i] = new FieldInfo(name, isIndexed, fieldNumber, 
storeTermVector, 
-                        omitNorms, storePayloads, indexOptions, null, 
-                        isIndexed && !omitNorms ? DocValuesType.NUMERIC : 
default(DocValuesType), // LUCENENET TODO: Bug.. default is not null
+                        omitNorms, storePayloads, indexOptions, 
DocValuesType.NONE, 
+                        isIndexed && !omitNorms ? DocValuesType.NUMERIC : 
DocValuesType.NONE,
                         Collections.EmptyMap<string, string>());
                 }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40DocValuesReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40DocValuesReader.cs 
b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40DocValuesReader.cs
index 2bbc0b4..b1cee7c 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40DocValuesReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40DocValuesReader.cs
@@ -31,7 +31,7 @@ namespace Lucene.Net.Codecs.Lucene40
     using IndexFileNames = Lucene.Net.Index.IndexFileNames;
     using IndexInput = Lucene.Net.Store.IndexInput;
     using IOUtils = Lucene.Net.Util.IOUtils;
-    using LegacyDocValuesType = 
Lucene.Net.Codecs.Lucene40.Lucene40FieldInfosReader.LegacyDocValuesType;
+    //using LegacyDocValuesType = 
Lucene.Net.Codecs.Lucene40.LegacyDocValuesType;
     using NumericDocValues = Lucene.Net.Index.NumericDocValues;
     using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s;
     using PagedBytes = Lucene.Net.Util.PagedBytes;
@@ -80,7 +80,7 @@ namespace Lucene.Net.Codecs.Lucene40
                     bool success = false;
                     try
                     {
-                        var type = 
LegacyDocValuesType.ValueOf(field.GetAttribute(legacyKey));
+                        var type = 
field.GetAttribute(legacyKey).ToLegacyDocValuesType();
 
                         //switch (Enum.Parse(typeof(LegacyDocValuesType), 
field.GetAttribute(LegacyKey)))
                         //{
@@ -425,7 +425,7 @@ namespace Lucene.Net.Codecs.Lucene40
                 BinaryDocValues instance;
                 if (!binaryInstances.TryGetValue(field.Number, out instance))
                 {
-                    var type = 
LegacyDocValuesType.ValueOf(field.GetAttribute(legacyKey));
+                    var type = 
field.GetAttribute(legacyKey).ToLegacyDocValuesType();
 
                     if (type == LegacyDocValuesType.BYTES_FIXED_STRAIGHT)
                     {
@@ -701,7 +701,7 @@ namespace Lucene.Net.Codecs.Lucene40
                         data = dir.OpenInput(dataName, state.Context);
                         index = dir.OpenInput(indexName, state.Context);
 
-                        var type = 
LegacyDocValuesType.ValueOf(field.GetAttribute(legacyKey));
+                        var type = 
field.GetAttribute(legacyKey).ToLegacyDocValuesType();
 
                         if (type == LegacyDocValuesType.BYTES_FIXED_SORTED)
                         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 f6f3a04..a0955aa 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40FieldInfosReader.cs
@@ -1,4 +1,3 @@
-using Lucene.Net.Support;
 using System;
 using System.Collections.Generic;
 
@@ -103,19 +102,19 @@ namespace Lucene.Net.Codecs.Lucene40
                     LegacyDocValuesType oldValuesType = 
GetDocValuesType((sbyte)(val & 0x0F));
                     LegacyDocValuesType oldNormsType = 
GetDocValuesType((sbyte)(((int)((uint)val >> 4)) & 0x0F));
                     IDictionary<string, string> attributes = 
input.ReadStringStringMap();
-                    if (oldValuesType.Mapping != null)
+                    if (oldValuesType.GetMapping() != DocValuesType.NONE)
                     {
-                        attributes[LEGACY_DV_TYPE_KEY] = oldValuesType.Name;
+                        attributes[LEGACY_DV_TYPE_KEY] = 
oldValuesType.ToString();
                     }
-                    if (oldNormsType.Mapping != null)
+                    if (oldNormsType.GetMapping() != DocValuesType.NONE)
                     {
-                        if (oldNormsType.Mapping != DocValuesType.NUMERIC)
+                        if (oldNormsType.GetMapping() != DocValuesType.NUMERIC)
                         {
                             throw new CorruptIndexException("invalid norm 
type: " + oldNormsType + " (resource=" + input + ")");
                         }
-                        attributes[LEGACY_NORM_TYPE_KEY] = oldNormsType.Name;
+                        attributes[LEGACY_NORM_TYPE_KEY] = 
oldNormsType.ToString();
                     }
-                    infos[i] = new FieldInfo(name, isIndexed, fieldNumber, 
storeTermVector, omitNorms, storePayloads, indexOptions, oldValuesType.Mapping, 
oldNormsType.Mapping, attributes);
+                    infos[i] = new FieldInfo(name, isIndexed, fieldNumber, 
storeTermVector, omitNorms, storePayloads, indexOptions, 
oldValuesType.GetMapping(), oldNormsType.GetMapping(), attributes);
                 }
                 CodecUtil.CheckEOF(input);
                 FieldInfos fieldInfos = new FieldInfos(infos);
@@ -138,107 +137,6 @@ namespace Lucene.Net.Codecs.Lucene40
         internal static readonly string LEGACY_DV_TYPE_KEY = 
typeof(Lucene40FieldInfosReader).Name + ".dvtype";
         internal static readonly string LEGACY_NORM_TYPE_KEY = 
typeof(Lucene40FieldInfosReader).Name + ".normtype";
 
-        internal class LegacyDocValuesType
-        {
-            internal static readonly LegacyDocValuesType NONE = new 
LegacyDocValuesType("NONE", null);
-            internal static readonly LegacyDocValuesType VAR_INTS = new 
LegacyDocValuesType("VAR_INTS", DocValuesType.NUMERIC);
-            internal static readonly LegacyDocValuesType FLOAT_32 = new 
LegacyDocValuesType("FLOAT_32", DocValuesType.NUMERIC);
-            internal static readonly LegacyDocValuesType FLOAT_64 = new 
LegacyDocValuesType("FLOAT_64", DocValuesType.NUMERIC);
-            internal static readonly LegacyDocValuesType BYTES_FIXED_STRAIGHT 
= new LegacyDocValuesType("BYTES_FIXED_STRAIGHT", DocValuesType.BINARY);
-            internal static readonly LegacyDocValuesType BYTES_FIXED_DEREF = 
new LegacyDocValuesType("BYTES_FIXED_DEREF", DocValuesType.BINARY);
-            internal static readonly LegacyDocValuesType BYTES_VAR_STRAIGHT = 
new LegacyDocValuesType("BYTES_VAR_STRAIGHT", DocValuesType.BINARY);
-            internal static readonly LegacyDocValuesType BYTES_VAR_DEREF = new 
LegacyDocValuesType("BYTES_VAR_DEREF", DocValuesType.BINARY);
-            internal static readonly LegacyDocValuesType FIXED_INTS_16 = new 
LegacyDocValuesType("FIXED_INTS_16", DocValuesType.NUMERIC);
-            internal static readonly LegacyDocValuesType FIXED_INTS_32 = new 
LegacyDocValuesType("FIXED_INTS_32", DocValuesType.NUMERIC);
-            internal static readonly LegacyDocValuesType FIXED_INTS_64 = new 
LegacyDocValuesType("FIXED_INTS_64", DocValuesType.NUMERIC);
-            internal static readonly LegacyDocValuesType FIXED_INTS_8 = new 
LegacyDocValuesType("FIXED_INTS_8", DocValuesType.NUMERIC);
-            internal static readonly LegacyDocValuesType BYTES_FIXED_SORTED = 
new LegacyDocValuesType("BYTES_FIXED_SORTED", DocValuesType.SORTED);
-            internal static readonly LegacyDocValuesType BYTES_VAR_SORTED = 
new LegacyDocValuesType("BYTES_VAR_SORTED", DocValuesType.SORTED);
-
-            private static readonly LegacyDocValuesType[] values = new[] {
-                NONE,
-                VAR_INTS,
-                FLOAT_32,
-                FLOAT_64,
-                BYTES_FIXED_STRAIGHT,
-                BYTES_FIXED_DEREF,
-                BYTES_VAR_STRAIGHT,
-                BYTES_VAR_DEREF,
-                FIXED_INTS_16,
-                FIXED_INTS_32,
-                FIXED_INTS_64,
-                FIXED_INTS_8,
-                BYTES_FIXED_SORTED,
-                BYTES_VAR_SORTED
-            };
-
-            private static readonly IDictionary<string, LegacyDocValuesType> 
nameLookup = new HashMap<string, 
LegacyDocValuesType>(StringComparer.OrdinalIgnoreCase) {
-                {"NONE", NONE},
-                {"VAR_INTS", VAR_INTS},
-                {"FLOAT_32", FLOAT_32},
-                {"FLOAT_64", FLOAT_64},
-                {"BYTES_FIXED_STRAIGHT", BYTES_FIXED_STRAIGHT},
-                {"BYTES_FIXED_DEREF", BYTES_FIXED_DEREF},
-                {"BYTES_VAR_STRAIGHT", BYTES_VAR_STRAIGHT},
-                {"BYTES_VAR_DEREF", BYTES_VAR_DEREF},
-                {"FIXED_INTS_16", FIXED_INTS_16},
-                {"FIXED_INTS_32", FIXED_INTS_32},
-                {"FIXED_INTS_64", FIXED_INTS_64},
-                {"FIXED_INTS_8", FIXED_INTS_8},
-                {"BYTES_FIXED_SORTED", BYTES_FIXED_SORTED},
-                {"BYTES_VAR_SORTED", BYTES_VAR_SORTED}
-            };
-
-            public static readonly IDictionary<string, int> ordinalLookup = 
new HashMap<string, int>(14) {
-                {"NONE", 0},
-                {"VAR_INTS", 1},
-                {"FLOAT_32", 2},
-                {"FLOAT_64", 3},
-                {"BYTES_FIXED_STRAIGHT", 4},
-                {"BYTES_FIXED_DEREF", 5},
-                {"BYTES_VAR_STRAIGHT", 6},
-                {"BYTES_VAR_DEREF", 7},
-                {"FIXED_INTS_16", 8},
-                {"FIXED_INTS_32", 9},
-                {"FIXED_INTS_64", 10},
-                {"FIXED_INTS_8", 11},
-                {"BYTES_FIXED_SORTED", 12},
-                {"BYTES_VAR_SORTED", 13}
-            };
-
-            private readonly DocValuesType? mapping;
-            private readonly string name;
-
-            private LegacyDocValuesType(string name, DocValuesType? mapping)
-            {
-                this.name = name;
-                this.mapping = mapping;
-            }
-
-            public DocValuesType? Mapping
-            {
-                get { return mapping; }
-            }
-
-            public string Name
-            {
-                get { return name; }
-            }
-
-            public static LegacyDocValuesType[] Values
-            {
-                get
-                {
-                    return values;
-                }
-            }
-
-            public static LegacyDocValuesType ValueOf(string value)
-            {
-                return nameLookup[value];
-            }
-        }
-
         // mapping of 4.0 types -> 4.2 types
         /*internal enum LegacyDocValuesType
         {
@@ -261,7 +159,58 @@ namespace Lucene.Net.Codecs.Lucene40
         // decodes a 4.0 type
         private static LegacyDocValuesType GetDocValuesType(sbyte b)
         {
-            return LegacyDocValuesType.Values[b];
+            //return LegacyDocValuesType.Values[b];
+            return (LegacyDocValuesType)b;
         }
     }
+
+    internal enum LegacyDocValuesType : sbyte
+    {
+        NONE,
+        VAR_INTS,
+        FLOAT_32,
+        FLOAT_64,
+        BYTES_FIXED_STRAIGHT,
+        BYTES_FIXED_DEREF,
+        BYTES_VAR_STRAIGHT,
+        BYTES_VAR_DEREF,
+        FIXED_INTS_16,
+        FIXED_INTS_32,
+        FIXED_INTS_64,
+        FIXED_INTS_8,
+        BYTES_FIXED_SORTED,
+        BYTES_VAR_SORTED
+    }
+
+    internal static class LegacyDocValuesTypeExtensions
+    {
+        public static DocValuesType GetMapping(this LegacyDocValuesType 
legacyDocValuesType)
+        {
+            return mapping[legacyDocValuesType];
+        }
+
+        public static LegacyDocValuesType ToLegacyDocValuesType(this string 
name) // Was ValueOf in Java
+        {
+            return 
(LegacyDocValuesType)Enum.Parse(typeof(LegacyDocValuesType), name);
+        }
+
+        // mapping of 4.0 types -> 4.2 types
+        internal static IDictionary<LegacyDocValuesType, DocValuesType> 
mapping = new Dictionary<LegacyDocValuesType, DocValuesType>
+        {
+            { LegacyDocValuesType.NONE, DocValuesType.NONE },
+            { LegacyDocValuesType.VAR_INTS, DocValuesType.NUMERIC },
+            { LegacyDocValuesType.FLOAT_32, DocValuesType.NUMERIC },
+            { LegacyDocValuesType.FLOAT_64, DocValuesType.NUMERIC },
+            { LegacyDocValuesType.BYTES_FIXED_STRAIGHT, DocValuesType.BINARY },
+            { LegacyDocValuesType.BYTES_FIXED_DEREF, DocValuesType.BINARY },
+            { LegacyDocValuesType.BYTES_VAR_STRAIGHT, DocValuesType.BINARY },
+            { LegacyDocValuesType.BYTES_VAR_DEREF, DocValuesType.BINARY },
+            { LegacyDocValuesType.FIXED_INTS_16, DocValuesType.NUMERIC },
+            { LegacyDocValuesType.FIXED_INTS_32, DocValuesType.NUMERIC },
+            { LegacyDocValuesType.FIXED_INTS_64, DocValuesType.NUMERIC },
+            { LegacyDocValuesType.FIXED_INTS_8, DocValuesType.NUMERIC },
+            { LegacyDocValuesType.BYTES_FIXED_SORTED, DocValuesType.SORTED },
+            { LegacyDocValuesType.BYTES_VAR_SORTED, DocValuesType.SORTED }
+        };
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 5229c37..b81c62d 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42FieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42FieldInfosReader.cs
@@ -95,8 +95,8 @@ namespace Lucene.Net.Codecs.Lucene42
 
                     // DV Types are packed in one byte
                     sbyte val = (sbyte)input.ReadByte();
-                    DocValuesType? docValuesType = GetDocValuesType(input, 
(sbyte)(val & 0x0F));
-                    DocValuesType? normsType = GetDocValuesType(input, 
(sbyte)(((int)((uint)val >> 4)) & 0x0F));
+                    DocValuesType docValuesType = GetDocValuesType(input, 
(sbyte)(val & 0x0F));
+                    DocValuesType normsType = GetDocValuesType(input, 
(sbyte)(((int)((uint)val >> 4)) & 0x0F));
                     IDictionary<string, string> attributes = 
input.ReadStringStringMap();
                     infos[i] = new FieldInfo(name, isIndexed, fieldNumber, 
storeTermVector, 
                         omitNorms, storePayloads, indexOptions, docValuesType, 
normsType, Collections.UnmodifiableMap(attributes));
@@ -120,11 +120,11 @@ namespace Lucene.Net.Codecs.Lucene42
             }
         }
 
-        private static DocValuesType? GetDocValuesType(IndexInput input, sbyte 
b)
+        private static DocValuesType GetDocValuesType(IndexInput input, sbyte 
b)
         {
             if (b == 0)
             {
-                return null;
+                return DocValuesType.NONE;
             }
             else if (b == 1)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 19d3685..0a3bacc 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosReader.cs
@@ -91,8 +91,8 @@ namespace Lucene.Net.Codecs.Lucene46
 
                     // DV Types are packed in one byte
                     byte val = input.ReadByte();
-                    DocValuesType? docValuesType = GetDocValuesType(input, 
(sbyte)(val & 0x0F));
-                    DocValuesType? normsType = GetDocValuesType(input, 
(sbyte)(((int)((uint)val >> 4)) & 0x0F));
+                    DocValuesType docValuesType = GetDocValuesType(input, 
(sbyte)(val & 0x0F));
+                    DocValuesType normsType = GetDocValuesType(input, 
(sbyte)(((int)((uint)val >> 4)) & 0x0F));
                     long dvGen = input.ReadInt64();
                     IDictionary<string, string> attributes = 
input.ReadStringStringMap();
                     infos[i] = new FieldInfo(name, isIndexed, fieldNumber, 
storeTermVector, omitNorms, storePayloads, indexOptions, docValuesType, 
normsType, Collections.UnmodifiableMap(attributes));
@@ -126,11 +126,11 @@ namespace Lucene.Net.Codecs.Lucene46
             }
         }
 
-        private static DocValuesType? GetDocValuesType(IndexInput input, sbyte 
b)
+        private static DocValuesType GetDocValuesType(IndexInput input, sbyte 
b)
         {
             if (b == 0)
             {
-                return default(DocValuesType?);
+                return DocValuesType.NONE;
             }
             else if (b == 1)
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 7af8cf8..b1732da 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene46/Lucene46FieldInfosWriter.cs
@@ -114,9 +114,9 @@ namespace Lucene.Net.Codecs.Lucene46
             }
         }
 
-        private static sbyte DocValuesByte(DocValuesType? type)
+        private static sbyte DocValuesByte(DocValuesType type)
         {
-            if (type == null)
+            if (type == DocValuesType.NONE)
             {
                 return 0;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 d6850fd..f12696e 100644
--- a/src/Lucene.Net.Core/Document/FieldType.cs
+++ b/src/Lucene.Net.Core/Document/FieldType.cs
@@ -41,7 +41,7 @@ namespace Lucene.Net.Documents
         private NumericType? numericType;
         private bool frozen;
         private int numericPrecisionStep = NumericUtils.PRECISION_STEP_DEFAULT;
-        private DocValuesType? docValueType;
+        private DocValuesType docValueType;
 
         /// <summary>
         /// Create a new mutable <see cref="FieldType"/> with all of the 
properties from <paramref name="ref"/>
@@ -349,7 +349,7 @@ namespace Lucene.Net.Documents
                     result.Append(numericPrecisionStep);
                 }
             }
-            if (docValueType != null)
+            if (docValueType != DocValuesType.NONE)
             {
                 if (result.Length > 0)
                 {
@@ -363,13 +363,13 @@ namespace Lucene.Net.Documents
         }
 
         /// <summary>
-        /// Sets the field's <see cref="DocValuesType"/>, or set to 
<c>null</c> if no <see cref="DocValues"/> should be stored.
+        /// Sets the field's <see cref="DocValuesType"/>, or set to <see 
cref="DocValuesType.NONE"/> if no <see cref="DocValues"/> should be stored.
         /// <para/>
-        /// The default is <c>null</c> (no <see cref="DocValues"/>).
+        /// The default is <see cref="DocValuesType.NONE"/> (no <see 
cref="DocValues"/>).
         /// </summary>
         /// <exception cref="InvalidOperationException"> if this <see 
cref="FieldType"/> is frozen against
         ///         future modifications. </exception>
-        public virtual DocValuesType? DocValueType
+        public virtual DocValuesType DocValueType
         {
             get
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Core/Index/DocValuesProcessor.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/DocValuesProcessor.cs 
b/src/Lucene.Net.Core/Index/DocValuesProcessor.cs
index 0dfd6c7..a70d5f5 100644
--- a/src/Lucene.Net.Core/Index/DocValuesProcessor.cs
+++ b/src/Lucene.Net.Core/Index/DocValuesProcessor.cs
@@ -51,8 +51,8 @@ namespace Lucene.Net.Index
 
         public override void AddField(int docID, IIndexableField field, 
FieldInfo fieldInfo)
         {
-            DocValuesType? dvType = field.FieldType.DocValueType;
-            if (dvType != null)
+            DocValuesType dvType = field.FieldType.DocValueType;
+            if (dvType != DocValuesType.NONE)
             {
                 fieldInfo.DocValuesType = dvType;
                 if (dvType == DocValuesType.BINARY)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 873980d..ac8e848 100644
--- a/src/Lucene.Net.Core/Index/FieldInfo.cs
+++ b/src/Lucene.Net.Core/Index/FieldInfo.cs
@@ -40,12 +40,12 @@ namespace Lucene.Net.Index
         public int Number { get; private set; }
 
         private bool indexed;
-        private DocValuesType? docValueType;
+        private DocValuesType docValueType;
 
         // True if any document indexed term vectors
         private bool storeTermVector;
 
-        private DocValuesType? normType;
+        private DocValuesType normType;
         private bool omitNorms; // omit norms associated with indexed fields
         private IndexOptions indexOptions;
         private bool storePayloads; // whether this field stores payloads 
together with term positions
@@ -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;
@@ -75,7 +75,7 @@ namespace Lucene.Net.Index
                 this.storePayloads = storePayloads;
                 this.omitNorms = omitNorms;
                 this.indexOptions = indexOptions;
-                this.normType = !omitNorms ? normsType : null;
+                this.normType = !omitNorms ? normsType : DocValuesType.NONE;
             } // for non-indexed fields, leave defaults
             else
             {
@@ -83,7 +83,7 @@ namespace Lucene.Net.Index
                 this.storePayloads = false;
                 this.omitNorms = false;
                 this.indexOptions = IndexOptions.NONE;
-                this.normType = null;
+                this.normType = DocValuesType.NONE;
             }
             this.attributes = attributes;
             Debug.Assert(CheckConsistency());
@@ -96,7 +96,7 @@ namespace Lucene.Net.Index
                 Debug.Assert(!storeTermVector);
                 Debug.Assert(!storePayloads);
                 Debug.Assert(!omitNorms);
-                Debug.Assert(normType == null);
+                Debug.Assert(normType == DocValuesType.NONE);
                 Debug.Assert(indexOptions == IndexOptions.NONE);
             }
             else
@@ -104,7 +104,7 @@ namespace Lucene.Net.Index
                 Debug.Assert(indexOptions != IndexOptions.NONE);
                 if (omitNorms)
                 {
-                    Debug.Assert(normType == null);
+                    Debug.Assert(normType == DocValuesType.NONE);
                 }
                 // Cannot store payloads unless positions are indexed:
                 
Debug.Assert(indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) 
>= 0 || !this.storePayloads);
@@ -139,7 +139,7 @@ namespace Lucene.Net.Index
                 if (this.omitNorms != omitNorms)
                 {
                     this.omitNorms = true; // if one require omitNorms at 
least once, it remains off for life
-                    this.normType = null;
+                    this.normType = DocValuesType.NONE;
                 }
                 if (this.indexOptions != indexOptions)
                 {
@@ -162,11 +162,11 @@ namespace Lucene.Net.Index
             Debug.Assert(CheckConsistency());
         }
 
-        public DocValuesType? DocValuesType
+        public DocValuesType DocValuesType
         {
             internal set
             {
-                if (docValueType != null && docValueType != value)
+                if (docValueType != DocValuesType.NONE && docValueType != 
value)
                 {
                     throw new System.ArgumentException("cannot change 
DocValues type from " + docValueType + " to " + value + " for field \"" + Name 
+ "\"");
                 }
@@ -194,7 +194,7 @@ namespace Lucene.Net.Index
         /// </summary>
         public bool HasDocValues
         {
-            get { return docValueType != null; }
+            get { return docValueType != DocValuesType.NONE; }
         }
 
         /// <summary>
@@ -212,9 +212,9 @@ namespace Lucene.Net.Index
         }
 
         /// <summary>
-        /// Returns <see cref="Index.DocValuesType"/> of the norm. This may be 
<c>null</c> if the field has no norms.
+        /// Returns <see cref="Index.DocValuesType"/> of the norm. This may be 
<see cref="DocValuesType.NONE"/> if the field has no norms.
         /// </summary>
-        public DocValuesType? NormType
+        public DocValuesType NormType
         {
             get
             {
@@ -222,7 +222,7 @@ namespace Lucene.Net.Index
             }
             internal set
             {
-                if (normType != null && normType != value)
+                if (normType != DocValuesType.NONE && normType != value)
                 {
                     throw new System.ArgumentException("cannot change Norm 
type from " + normType + " to " + value + " for field \"" + Name + "\"");
                 }
@@ -259,7 +259,7 @@ namespace Lucene.Net.Index
         /// </summary>
         public bool HasNorms
         {
-            get { return normType != null; }
+            get { return normType != DocValuesType.NONE; }
         }
 
         /// <summary>
@@ -398,29 +398,37 @@ namespace Lucene.Net.Index
     public enum DocValuesType // LUCENENET specific: de-nested from FieldInfo 
to prevent naming collisions
     {
         /// <summary>
-        /// A per-document Number
+        /// No doc values type will be used.
+        /// <para/>
+        /// NOTE: This is the same as setting to <c>null</c> in Lucene
+        /// </summary>
+        // LUCENENET specific
+        NONE, // LUCENENET NOTE: The value of this option is 0, which is the 
default value for any .NET value type
+
+        /// <summary>
+        /// A per-document numeric type
         /// </summary>
         NUMERIC,
 
         /// <summary>
-        /// A per-document byte[].  Values may be larger than
+        /// A per-document <see cref="T:byte[]"/>.  Values may be larger than
         /// 32766 bytes, but different codecs may enforce their own limits.
         /// </summary>
         BINARY,
 
         /// <summary>
-        /// A pre-sorted byte[]. Fields with this type only store distinct 
byte values
+        /// A pre-sorted <see cref="T: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.
+        /// ordinal and by-value.  Values must be &lt;= 32766 bytes.
         /// </summary>
         SORTED,
 
         /// <summary>
-        /// A pre-sorted Set&lt;byte[]&gt;. Fields with this type only store 
distinct byte values
+        /// A pre-sorted ISet&lt;byte[]&gt;. 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.
+        /// <see cref="T:byte[]"/>s. The stored <see cref="T:byte[]"/> is 
presorted and allows access via document id,
+        /// ordinal and by-value.  Values must be &lt;= 32766 bytes.
         /// </summary>
         SORTED_SET
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/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 19d1acc..9838018 100644
--- a/src/Lucene.Net.Core/Index/FieldInfos.cs
+++ b/src/Lucene.Net.Core/Index/FieldInfos.cs
@@ -209,7 +209,7 @@ namespace Lucene.Net.Index
             // We use this to enforce that a given field never
             // changes DV type, even across segments / IndexWriter
             // sessions:
-            private readonly IDictionary<string, DocValuesType?> docValuesType;
+            private readonly IDictionary<string, DocValuesType> docValuesType;
 
             // TODO: we should similarly catch an attempt to turn
             // norms back on after they were already ommitted; today
@@ -220,7 +220,7 @@ namespace Lucene.Net.Index
             {
                 this.nameToNumber = new Dictionary<string, int?>();
                 this.numberToName = new Dictionary<int?, string>();
-                this.docValuesType = new Dictionary<string, DocValuesType?>();
+                this.docValuesType = new Dictionary<string, DocValuesType>();
             }
 
             /// <summary>
@@ -229,19 +229,19 @@ namespace Lucene.Net.Index
             /// number assigned if possible otherwise the first unassigned 
field number
             /// is used as the field number.
             /// </summary>
-            internal int AddOrGet(string fieldName, int preferredFieldNumber, 
DocValuesType? dvType)
+            internal int AddOrGet(string fieldName, int preferredFieldNumber, 
DocValuesType dvType)
             {
                 lock (this)
                 {
-                    if (dvType != null)
+                    if (dvType != DocValuesType.NONE)
                     {
-                        DocValuesType? currentDVType;
+                        DocValuesType currentDVType;
                         docValuesType.TryGetValue(fieldName, out 
currentDVType);
-                        if (currentDVType == null)
+                        if (currentDVType == DocValuesType.NONE) // default 
value in .NET (value type 0)
                         {
                             docValuesType[fieldName] = dvType;
                         }
-                        else if (currentDVType != null && currentDVType != 
dvType)
+                        else if (currentDVType != DocValuesType.NONE && 
currentDVType != dvType)
                         {
                             throw new System.ArgumentException("cannot change 
DocValues type from " + currentDVType + " to " + dvType + " for field \"" + 
fieldName + "\"");
                         }
@@ -276,13 +276,13 @@ namespace Lucene.Net.Index
             }
 
             // used by assert
-            internal bool ContainsConsistent(int? number, string name, 
DocValuesType? dvType)
+            internal bool ContainsConsistent(int? number, string name, 
DocValuesType dvType)
             {
                 lock (this)
                 {
                     string numberToNameStr;
                     int? nameToNumberVal;
-                    DocValuesType? docValuesType_E;
+                    DocValuesType docValuesType_E;
 
                     numberToName.TryGetValue(number, out numberToNameStr);
                     nameToNumber.TryGetValue(name, out nameToNumberVal);
@@ -290,7 +290,7 @@ namespace Lucene.Net.Index
 
                     return name.Equals(numberToNameStr, 
StringComparison.Ordinal) 
                         && number.Equals(nameToNumber[name]) && 
-                        (dvType == null || docValuesType_E == null || dvType 
== docValuesType_E);
+                        (dvType == DocValuesType.NONE || docValuesType_E == 
DocValuesType.NONE || dvType == docValuesType_E);
                 }
             }
 
@@ -298,7 +298,7 @@ namespace Lucene.Net.Index
             /// Returns true if the {@code fieldName} exists in the map and is 
of the
             /// same {@code dvType}.
             /// </summary>
-            internal bool Contains(string fieldName, DocValuesType? dvType)
+            internal bool Contains(string fieldName, DocValuesType dvType)
             {
                 lock (this)
                 {
@@ -310,7 +310,7 @@ namespace Lucene.Net.Index
                     else
                     {
                         // only return true if the field has the same dvType 
as the requested one
-                        DocValuesType? dvCand;
+                        DocValuesType dvCand;
                         docValuesType.TryGetValue(fieldName, out dvCand);
                         return dvType == dvCand;
                     }
@@ -327,7 +327,7 @@ namespace Lucene.Net.Index
                 }
             }
 
-            internal void SetDocValuesType(int number, string name, 
DocValuesType? dvType)
+            internal void SetDocValuesType(int number, string name, 
DocValuesType dvType)
             {
                 lock (this)
                 {
@@ -378,10 +378,10 @@ namespace Lucene.Net.Index
                 // rather, each component in the chain should update
                 // what it "owns".  EG fieldType.indexOptions() should
                 // be updated by maybe FreqProxTermsWriterPerField:
-                return AddOrUpdateInternal(name, -1, fieldType.IsIndexed, 
false, fieldType.OmitNorms, false, fieldType.IndexOptions, 
fieldType.DocValueType, null);
+                return AddOrUpdateInternal(name, -1, fieldType.IsIndexed, 
false, fieldType.OmitNorms, false, fieldType.IndexOptions, 
fieldType.DocValueType, DocValuesType.NONE);
             }
 
-            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)
@@ -401,7 +401,7 @@ namespace Lucene.Net.Index
                 {
                     fi.Update(isIndexed, storeTermVector, omitNorms, 
storePayloads, indexOptions);
 
-                    if (docValues != null)
+                    if (docValues != DocValuesType.NONE)
                     {
                         // only pay the synchronization cost if fi does not 
already have a DVType
                         bool updateGlobal = !fi.HasDocValues;
@@ -414,7 +414,7 @@ namespace Lucene.Net.Index
                         }
                     }
 
-                    if (!fi.OmitsNorms && normType != null)
+                    if (!fi.OmitsNorms && normType != DocValuesType.NONE)
                     {
                         fi.NormType = normType;
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Core/Index/IndexableFieldType.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/IndexableFieldType.cs 
b/src/Lucene.Net.Core/Index/IndexableFieldType.cs
index 5cb4e66..e87f192 100644
--- a/src/Lucene.Net.Core/Index/IndexableFieldType.cs
+++ b/src/Lucene.Net.Core/Index/IndexableFieldType.cs
@@ -82,14 +82,14 @@ namespace Lucene.Net.Index
 
         /// <summary>
         /// True if normalization values should be omitted for the field.
-        /// <p>
+        /// <para/>
         /// this saves memory, but at the expense of scoring quality (length 
normalization
         /// will be disabled), and if you omit norms, you cannot use 
index-time boosts.
         /// </summary>
         bool OmitNorms { get; }
 
         /// <summary>
-        /// <seealso cref="IndexOptions"/>, describing what should be
+        /// <see cref="Index.IndexOptions"/>, describing what should be
         /// recorded into the inverted index
         /// </summary>
         IndexOptions IndexOptions { get; }
@@ -97,9 +97,9 @@ namespace Lucene.Net.Index
         //NumericType? NumericType { get; }
 
         /// <summary>
-        /// DocValues <seealso cref="DocValuesType"/>: if non-null then the 
field's value
+        /// DocValues <see cref="DocValuesType"/>: if not <see 
cref="DocValuesType.NONE"/> then the field's value
         /// will be indexed into docValues.
         /// </summary>
-        DocValuesType? DocValueType { get; }
+        DocValuesType DocValueType { get; }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Core/Index/NormsConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/NormsConsumer.cs 
b/src/Lucene.Net.Core/Index/NormsConsumer.cs
index d196999..9228827 100644
--- a/src/Lucene.Net.Core/Index/NormsConsumer.cs
+++ b/src/Lucene.Net.Core/Index/NormsConsumer.cs
@@ -64,7 +64,7 @@ namespace Lucene.Net.Index
                             }
                             else if (fi.IsIndexed)
                             {
-                                Debug.Assert(fi.NormType == null, "got " + 
fi.NormType + "; field=" + fi.Name);
+                                Debug.Assert(fi.NormType == 
DocValuesType.NONE, "got " + fi.NormType + "; field=" + fi.Name);
                             }
                         }
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Core/Index/SegmentMerger.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentMerger.cs 
b/src/Lucene.Net.Core/Index/SegmentMerger.cs
index f45f30d..e43f808 100644
--- a/src/Lucene.Net.Core/Index/SegmentMerger.cs
+++ b/src/Lucene.Net.Core/Index/SegmentMerger.cs
@@ -181,8 +181,8 @@ namespace Lucene.Net.Index
             {
                 foreach (FieldInfo field in mergeState.FieldInfos)
                 {
-                    DocValuesType? type = field.DocValuesType;
-                    if (type != null)
+                    DocValuesType type = field.DocValuesType;
+                    if (type != DocValuesType.NONE)
                     {
                         if (type == DocValuesType.NUMERIC)
                         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Core/Index/SegmentReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentReader.cs 
b/src/Lucene.Net.Core/Index/SegmentReader.cs
index 9743fdf..e6bce27 100644
--- a/src/Lucene.Net.Core/Index/SegmentReader.cs
+++ b/src/Lucene.Net.Core/Index/SegmentReader.cs
@@ -271,7 +271,7 @@ namespace Lucene.Net.Index
             IDictionary<long?, IList<FieldInfo>> genInfos = new 
Dictionary<long?, IList<FieldInfo>>();
             foreach (FieldInfo fi in FieldInfos)
             {
-                if (fi.DocValuesType == null)
+                if (fi.DocValuesType == DocValuesType.NONE)
                 {
                     continue;
                 }
@@ -494,7 +494,7 @@ namespace Lucene.Net.Index
                 // Field does not exist
                 return null;
             }
-            if (fi.DocValuesType == null)
+            if (fi.DocValuesType == DocValuesType.NONE)
             {
                 // Field was not indexed with doc values
                 return null;
@@ -544,7 +544,7 @@ namespace Lucene.Net.Index
                 // Field does not exist
                 return null;
             }
-            if (fi.DocValuesType == null)
+            if (fi.DocValuesType == DocValuesType.NONE)
             {
                 // Field was not indexed with doc values
                 return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Memory/MemoryIndex.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Memory/MemoryIndex.cs 
b/src/Lucene.Net.Memory/MemoryIndex.cs
index 5985a40..9d4b551 100644
--- a/src/Lucene.Net.Memory/MemoryIndex.cs
+++ b/src/Lucene.Net.Memory/MemoryIndex.cs
@@ -425,7 +425,16 @@ namespace Lucene.Net.Index.Memory
 
                 if (!fieldInfos.ContainsKey(fieldName))
                 {
-                    fieldInfos[fieldName] = new FieldInfo(fieldName, true, 
fieldInfos.Count, false, false, false, this.storeOffsets ? 
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : 
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, null, null, null);
+                    fieldInfos[fieldName] = new FieldInfo(fieldName, 
+                                                        true, 
+                                                        fieldInfos.Count, 
+                                                        false, 
+                                                        false, 
+                                                        false, 
+                                                        this.storeOffsets ? 
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS : 
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS, 
+                                                        DocValuesType.NONE, 
+                                                        DocValuesType.NONE, 
+                                                        null);
                 }
                 ITermToBytesRefAttribute termAtt = 
stream.GetAttribute<ITermToBytesRefAttribute>();
                 IPositionIncrementAttribute posIncrAttribute = 
stream.AddAttribute<IPositionIncrementAttribute>();

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs
----------------------------------------------------------------------
diff --git 
a/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs 
b/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs
index 0d91fb0..564efd2 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Asserting/AssertingDocValuesFormat.cs
@@ -319,7 +319,7 @@ namespace Lucene.Net.Codecs.Asserting
 
             public override IBits GetDocsWithField(FieldInfo field)
             {
-                Debug.Assert(field.DocValuesType != null);
+                Debug.Assert(field.DocValuesType != DocValuesType.NONE);
                 IBits bits = @in.GetDocsWithField(field);
                 Debug.Assert(bits != null);
                 Debug.Assert(bits.Length == MaxDoc);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
----------------------------------------------------------------------
diff --git 
a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs 
b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
index 623b53b..8cd827f 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosReader.cs
@@ -103,14 +103,23 @@ namespace Lucene.Net.Codecs.Lucene3x
                         storePayloads = false;
                     }
 
-                    DocValuesType? normType = isIndexed && !omitNorms ? 
(DocValuesType?)DocValuesType.NUMERIC : null;
-                    if (format == PreFlexRWFieldInfosWriter.FORMAT_PREFLEX_RW 
&& normType != null)
+                    DocValuesType normType = isIndexed && !omitNorms ? 
DocValuesType.NUMERIC : DocValuesType.NONE;
+                    if (format == PreFlexRWFieldInfosWriter.FORMAT_PREFLEX_RW 
&& normType != DocValuesType.NONE)
                     {
                         // RW can have norms but doesn't write them
-                        normType = input.ReadByte() != 0 ? 
(DocValuesType?)DocValuesType.NUMERIC : null;
+                        normType = input.ReadByte() != 0 ? 
DocValuesType.NUMERIC : DocValuesType.NONE;
                     }
 
-                    infos[i] = new FieldInfo(name, isIndexed, fieldNumber, 
storeTermVector, omitNorms, storePayloads, indexOptions, null, normType, null);
+                    infos[i] = new FieldInfo(name, 
+                                            isIndexed, 
+                                            fieldNumber, 
+                                            storeTermVector, 
+                                            omitNorms, 
+                                            storePayloads, 
+                                            indexOptions, 
+                                            DocValuesType.NONE, 
+                                            normType, 
+                                            null);
                 }
 
                 if (input.FilePointer != input.Length)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs
----------------------------------------------------------------------
diff --git 
a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs 
b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs
index e0fef49..6651cb2 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene3x/PreFlexRWFieldInfosWriter.cs
@@ -108,7 +108,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                     {
                         // to allow null norm types we need to indicate if 
norms are written
                         // only in RW case
-                        output.WriteByte((byte)(sbyte)(fi.NormType == null ? 0 
: 1));
+                        output.WriteByte((byte)(sbyte)(fi.NormType == 
Index.DocValuesType.NONE ? 0 : 1));
                     }
                     Debug.Assert(fi.Attributes == null); // not used or 
supported
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs
----------------------------------------------------------------------
diff --git 
a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs 
b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs
index ecb0c69..3747a6a 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40DocValuesWriter.cs
@@ -30,7 +30,7 @@ namespace Lucene.Net.Codecs.Lucene40
          * limitations under the License.
          */
 
-    using LegacyDocValuesType = 
Lucene.Net.Codecs.Lucene40.Lucene40FieldInfosReader.LegacyDocValuesType;
+    //using LegacyDocValuesType = 
Lucene.Net.Codecs.Lucene40.LegacyDocValuesType;
     using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s;
     using SegmentWriteState = Lucene.Net.Index.SegmentWriteState;
 
@@ -103,7 +103,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddBytesField(FieldInfo field, IndexOutput output, 
IEnumerable<long?> values)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.FIXED_INTS_8.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.FIXED_INTS_8.ToString());
             CodecUtil.WriteHeader(output, 
Lucene40DocValuesFormat.INTS_CODEC_NAME, 
Lucene40DocValuesFormat.INTS_VERSION_CURRENT);
             output.WriteInt32(1); // size
             foreach (long? n in values)
@@ -114,7 +114,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddShortsField(FieldInfo field, IndexOutput output, 
IEnumerable<long?> values)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.FIXED_INTS_16.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.FIXED_INTS_16.ToString());
             CodecUtil.WriteHeader(output, 
Lucene40DocValuesFormat.INTS_CODEC_NAME, 
Lucene40DocValuesFormat.INTS_VERSION_CURRENT);
             output.WriteInt32(2); // size
             foreach (long? n in values)
@@ -125,7 +125,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddIntsField(FieldInfo field, IndexOutput output, 
IEnumerable<long?> values)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.FIXED_INTS_32.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.FIXED_INTS_32.ToString());
             CodecUtil.WriteHeader(output, 
Lucene40DocValuesFormat.INTS_CODEC_NAME, 
Lucene40DocValuesFormat.INTS_VERSION_CURRENT);
             output.WriteInt32(4); // size
             foreach (long? n in values)
@@ -136,7 +136,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddVarIntsField(FieldInfo field, IndexOutput output, 
IEnumerable<long?> values, long minValue, long maxValue)
         {
-            field.PutAttribute(LegacyKey, LegacyDocValuesType.VAR_INTS.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.VAR_INTS.ToString());
 
             CodecUtil.WriteHeader(output, 
Lucene40DocValuesFormat.VAR_INTS_CODEC_NAME, 
Lucene40DocValuesFormat.VAR_INTS_VERSION_CURRENT);
 
@@ -297,7 +297,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddFixedStraightBytesField(FieldInfo field, IndexOutput 
output, IEnumerable<BytesRef> values, int length)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_FIXED_STRAIGHT.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_FIXED_STRAIGHT.ToString());
 
             CodecUtil.WriteHeader(output, 
Lucene40DocValuesFormat.BYTES_FIXED_STRAIGHT_CODEC_NAME, 
Lucene40DocValuesFormat.BYTES_FIXED_STRAIGHT_VERSION_CURRENT);
 
@@ -314,7 +314,7 @@ namespace Lucene.Net.Codecs.Lucene40
         // NOTE: 4.0 file format docs are crazy/wrong here...
         private void AddVarStraightBytesField(FieldInfo field, IndexOutput 
data, IndexOutput index, IEnumerable<BytesRef> values)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_VAR_STRAIGHT.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_VAR_STRAIGHT.ToString());
 
             CodecUtil.WriteHeader(data, 
Lucene40DocValuesFormat.BYTES_VAR_STRAIGHT_CODEC_NAME_DAT, 
Lucene40DocValuesFormat.BYTES_VAR_STRAIGHT_VERSION_CURRENT);
 
@@ -358,7 +358,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddFixedDerefBytesField(FieldInfo field, IndexOutput 
data, IndexOutput index, IEnumerable<BytesRef> values, int length)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_FIXED_DEREF.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_FIXED_DEREF.ToString());
 
             CodecUtil.WriteHeader(data, 
Lucene40DocValuesFormat.BYTES_FIXED_DEREF_CODEC_NAME_DAT, 
Lucene40DocValuesFormat.BYTES_FIXED_DEREF_VERSION_CURRENT);
 
@@ -403,7 +403,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddVarDerefBytesField(FieldInfo field, IndexOutput data, 
IndexOutput index, IEnumerable<BytesRef> values)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_VAR_DEREF.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_VAR_DEREF.ToString());
 
             CodecUtil.WriteHeader(data, 
Lucene40DocValuesFormat.BYTES_VAR_DEREF_CODEC_NAME_DAT, 
Lucene40DocValuesFormat.BYTES_VAR_DEREF_VERSION_CURRENT);
 
@@ -530,7 +530,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddFixedSortedBytesField(FieldInfo field, IndexOutput 
data, IndexOutput index, IEnumerable<BytesRef> values, IEnumerable<long?> 
docToOrd, int length)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_FIXED_SORTED.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_FIXED_SORTED.ToString());
 
             CodecUtil.WriteHeader(data, 
Lucene40DocValuesFormat.BYTES_FIXED_SORTED_CODEC_NAME_DAT, 
Lucene40DocValuesFormat.BYTES_FIXED_SORTED_VERSION_CURRENT);
 
@@ -561,7 +561,7 @@ namespace Lucene.Net.Codecs.Lucene40
 
         private void AddVarSortedBytesField(FieldInfo field, IndexOutput data, 
IndexOutput index, IEnumerable<BytesRef> values, IEnumerable<long?> docToOrd)
         {
-            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_VAR_SORTED.Name);
+            field.PutAttribute(LegacyKey, 
LegacyDocValuesType.BYTES_VAR_SORTED.ToString());
 
             CodecUtil.WriteHeader(data, 
Lucene40DocValuesFormat.BYTES_VAR_SORTED_CODEC_NAME_DAT, 
Lucene40DocValuesFormat.BYTES_VAR_SORTED_VERSION_CURRENT);
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git 
a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs 
b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
index 443fb7d..bcefd88 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene40/Lucene40FieldInfosWriter.cs
@@ -30,7 +30,6 @@ namespace Lucene.Net.Codecs.Lucene40
          * limitations under the License.
          */
 
-    using LegacyDocValuesType = 
Lucene.Net.Codecs.Lucene40.Lucene40FieldInfosReader.LegacyDocValuesType;
 
     /// <summary>
     /// Lucene 4.0 FieldInfos writer.
@@ -117,9 +116,9 @@ namespace Lucene.Net.Codecs.Lucene40
 
         /// <summary>
         /// 4.0-style docvalues byte </summary>
-        public virtual sbyte DocValuesByte(DocValuesType? type, string 
legacyTypeAtt)
+        public virtual sbyte DocValuesByte(DocValuesType type, string 
legacyTypeAtt)
         {
-            if (type == null)
+            if (type == DocValuesType.NONE)
             {
                 Debug.Assert(legacyTypeAtt == null);
                 return 0;
@@ -127,7 +126,8 @@ namespace Lucene.Net.Codecs.Lucene40
             else
             {
                 Debug.Assert(legacyTypeAtt != null);
-                return (sbyte)LegacyDocValuesType.ordinalLookup[legacyTypeAtt];
+                //return 
(sbyte)LegacyDocValuesType.ordinalLookup[legacyTypeAtt];
+                return (sbyte)legacyTypeAtt.ToLegacyDocValuesType();
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
----------------------------------------------------------------------
diff --git 
a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs 
b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
index 707b195..d50a008 100644
--- a/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
+++ b/src/Lucene.Net.TestFramework/Codecs/Lucene42/Lucene42FieldInfosWriter.cs
@@ -114,9 +114,9 @@ namespace Lucene.Net.Codecs.Lucene42
             }
         }
 
-        private static sbyte DocValuesByte(DocValuesType? type)
+        private static sbyte DocValuesByte(DocValuesType type)
         {
-            if (type == null)
+            if (type == DocValuesType.NONE)
             {
                 return 0;
             }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs 
b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
index 5980ce8..035ac8d 100644
--- a/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BasePostingsFormatTestCase.cs
@@ -396,8 +396,8 @@ namespace Lucene.Net.Index
                 }
 
                 fieldInfoArray[fieldUpto] = new FieldInfo(field, true, 
fieldUpto, false, false, true, 
-                                                        
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS, 
-                                                        null, 
DocValuesType.NUMERIC, null);
+                                                        
IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS,
+                                                        DocValuesType.NONE, 
DocValuesType.NUMERIC, null);
                 fieldUpto++;
 
                 SortedDictionary<BytesRef, long> postings = new 
SortedDictionary<BytesRef, long>();
@@ -543,7 +543,7 @@ namespace Lucene.Net.Index
                 IndexOptions indexOptions = 
Enum.GetValues(typeof(IndexOptions)).Cast<IndexOptions>().ToArray()[alwaysTestMax
 ? fieldMaxIndexOption : Random().Next(1, 1 + fieldMaxIndexOption)]; // 
LUCENENET: Skipping NONE option
                 bool doPayloads = 
indexOptions.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0 && 
allowPayloads;
 
-                newFieldInfoArray[fieldUpto] = new 
FieldInfo(oldFieldInfo.Name, true, fieldUpto, false, false, doPayloads, 
indexOptions, null, DocValuesType.NUMERIC, null);
+                newFieldInfoArray[fieldUpto] = new 
FieldInfo(oldFieldInfo.Name, true, fieldUpto, false, false, doPayloads, 
indexOptions, DocValuesType.NONE, DocValuesType.NUMERIC, null);
             }
 
             FieldInfos newFieldInfos = new FieldInfos(newFieldInfoArray);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.TestFramework/Util/TestUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/TestUtil.cs 
b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
index c511dc9..2340162 100644
--- a/src/Lucene.Net.TestFramework/Util/TestUtil.cs
+++ b/src/Lucene.Net.TestFramework/Util/TestUtil.cs
@@ -1035,9 +1035,9 @@ namespace Lucene.Net.Util
             {
                 Field field1 = (Field)f;
                 Field field2;
-                DocValuesType? dvType = field1.FieldType.DocValueType;
+                DocValuesType dvType = field1.FieldType.DocValueType;
                 Documents.NumericType? numType = 
((FieldType)field1.FieldType).NumericType;
-                if (dvType != null)
+                if (dvType != DocValuesType.NONE)
                 {
                     switch (dvType)
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs 
b/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs
index 5daab0c..3a34c17 100644
--- a/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs
+++ b/src/Lucene.Net.Tests.Grouping/AllGroupHeadsCollectorTest.cs
@@ -37,7 +37,8 @@ namespace Lucene.Net.Search.Grouping
 
     public class AllGroupHeadsCollectorTest : LuceneTestCase
     {
-        private static readonly DocValuesType[] vts = new DocValuesType[]{
+        private static readonly DocValuesType[] vts = new DocValuesType[]
+        {
             DocValuesType.BINARY, DocValuesType.SORTED
         };
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs 
b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
index c481373..fdbcb8c 100644
--- a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
+++ b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs
@@ -90,7 +90,7 @@ namespace Lucene.Net.Search.Grouping
                 NewIndexWriterConfig(TEST_VERSION_CURRENT,
                     new 
MockAnalyzer(random)).SetMergePolicy(NewLogMergePolicy()));
             bool canUseDV = !"Lucene3x".Equals(w.w.Config.Codec.Name, 
StringComparison.Ordinal);
-            DocValuesType? dvType = canUseDV ? 
dvTypes[random.nextInt(dvTypes.Length)] : (DocValuesType?)null;
+            DocValuesType dvType = canUseDV ? 
dvTypes[random.nextInt(dvTypes.Length)] : DocValuesType.NONE;
 
             Document doc = new Document();
             AddField(doc, groupField, "1", dvType);
@@ -155,7 +155,7 @@ namespace Lucene.Net.Search.Grouping
             IAbstractFirstPassGroupingCollector<IComparable> firstCollector = 
CreateRandomFirstPassCollector(dvType, new Sort(), groupField, 10);
             indexSearcher.Search(new TermQuery(new Term("content", "random")), 
firstCollector);
             
IAbstractDistinctValuesCollector<AbstractDistinctValuesCollector.IGroupCount<IComparable>>
 distinctValuesCollector
-                = CreateDistinctCountCollector(firstCollector, groupField, 
countField, dvType.GetValueOrDefault());
+                = CreateDistinctCountCollector(firstCollector, groupField, 
countField, dvType);
             indexSearcher.Search(new TermQuery(new Term("content", "random")), 
distinctValuesCollector);
 
             //var gcs = distinctValuesCollector.Groups as 
List<IGroupCount<IComparable>>;
@@ -253,8 +253,8 @@ namespace Lucene.Net.Search.Grouping
                 for (int searchIter = 0; searchIter < 100; searchIter++)
                 {
                     IndexSearcher searcher = NewSearcher(context.indexReader);
-                    bool useDv = context.dvType != null && 
random.nextBoolean();
-                    DocValuesType? dvType = useDv ? context.dvType : null;
+                    bool useDv = context.dvType != DocValuesType.NONE && 
random.nextBoolean();
+                    DocValuesType dvType = useDv ? context.dvType : 
DocValuesType.NONE;
                     string term = 
context.contentStrings[random.nextInt(context.contentStrings.Length)];
                     Sort groupSort = new Sort(new SortField("id", 
SortFieldType.STRING));
                     int topN = 1 + random.nextInt(10);
@@ -404,10 +404,10 @@ namespace Lucene.Net.Search.Grouping
             }
         }
 
-        private void AddField(Document doc, string field, string value, 
DocValuesType? type)
+        private void AddField(Document doc, string field, string value, 
DocValuesType type)
         {
             doc.Add(new StringField(field, value, Field.Store.YES));
-            if (type == null)
+            if (type == DocValuesType.NONE)
             {
                 return;
             }
@@ -432,7 +432,7 @@ namespace Lucene.Net.Search.Grouping
         private 
IAbstractDistinctValuesCollector<AbstractDistinctValuesCollector.IGroupCount<T>>
 CreateDistinctCountCollector<T>(IAbstractFirstPassGroupingCollector<T> 
firstPassGroupingCollector,
                                                                             
string groupField,
                                                                             
string countField,
-                                                                            
DocValuesType? dvType)
+                                                                            
DocValuesType dvType)
         {
             Random random = Random();
             IEnumerable<ISearchGroup<T>> searchGroups = 
firstPassGroupingCollector.GetTopGroups(0, false);
@@ -446,10 +446,10 @@ namespace Lucene.Net.Search.Grouping
             }
         }
 
-        private IAbstractFirstPassGroupingCollector<IComparable> 
CreateRandomFirstPassCollector(DocValuesType? dvType, Sort groupSort, string 
groupField, int topNGroups)
+        private IAbstractFirstPassGroupingCollector<IComparable> 
CreateRandomFirstPassCollector(DocValuesType dvType, Sort groupSort, string 
groupField, int topNGroups)
         {
             Random random = Random();
-            if (dvType != null)
+            if (dvType != DocValuesType.NONE)
             {
                 if (random.nextBoolean())
                 {
@@ -525,7 +525,7 @@ namespace Lucene.Net.Search.Grouping
               );
 
             bool canUseDV = !"Lucene3x".Equals(w.w.Config.Codec.Name, 
StringComparison.Ordinal);
-            DocValuesType? dvType = canUseDV ? 
dvTypes[random.nextInt(dvTypes.Length)] : (DocValuesType?)null;
+            DocValuesType dvType = canUseDV ? 
dvTypes[random.nextInt(dvTypes.Length)] : DocValuesType.NONE;
 
             int numDocs = 86 + random.nextInt(1087) * RANDOM_MULTIPLIER;
             string[] groupValues = new string[numDocs / 5];
@@ -594,11 +594,11 @@ namespace Lucene.Net.Search.Grouping
 
             internal readonly Directory directory;
             internal readonly DirectoryReader indexReader;
-            internal readonly DocValuesType? dvType;
+            internal readonly DocValuesType dvType;
             internal readonly IDictionary<string, IDictionary<string, 
ISet<string>>> searchTermToGroupCounts;
             internal readonly string[] contentStrings;
 
-            internal IndexContext(Directory directory, DirectoryReader 
indexReader, DocValuesType? dvType,
+            internal IndexContext(Directory directory, DirectoryReader 
indexReader, DocValuesType dvType,
                          IDictionary<string, IDictionary<string, 
ISet<string>>> searchTermToGroupCounts, string[] contentStrings)
             {
                 this.directory = directory;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs 
b/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
index 3dce56f..fcb8445 100644
--- a/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
+++ b/src/Lucene.Net.Tests.Queries/Function/TestDocValuesFieldSources.cs
@@ -139,7 +139,7 @@ namespace Lucene.Net.Tests.Queries.Function
             var values = Enum.GetValues(typeof(DocValuesType));
             foreach (DocValuesType type in values)
             {
-                if (type != DocValuesType.SORTED_SET)
+                if (type != DocValuesType.SORTED_SET && type != 
DocValuesType.NONE) // LUCENENET specific: eliminate our NONE option from test
                 {
                     DoTest(type);
                 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Tests/Index/TestCodecs.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestCodecs.cs 
b/src/Lucene.Net.Tests/Index/TestCodecs.cs
index 8feaf0b..d016bb0 100644
--- a/src/Lucene.Net.Tests/Index/TestCodecs.cs
+++ b/src/Lucene.Net.Tests/Index/TestCodecs.cs
@@ -181,9 +181,9 @@ namespace Lucene.Net.Index
                     get { return OmitTF ? Index.IndexOptions.DOCS_ONLY : 
Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
                 }
 
-                public DocValuesType? DocValueType
+                public DocValuesType DocValueType
                 {
-                    get { return null; }
+                    get { return DocValuesType.NONE; }
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0169d4aa/src/Lucene.Net.Tests/Index/TestIndexableField.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Index/TestIndexableField.cs 
b/src/Lucene.Net.Tests/Index/TestIndexableField.cs
index e7780d8..e7f5856 100644
--- a/src/Lucene.Net.Tests/Index/TestIndexableField.cs
+++ b/src/Lucene.Net.Tests/Index/TestIndexableField.cs
@@ -125,9 +125,9 @@ namespace Lucene.Net.Index
                     get { return 
Index.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; }
                 }
 
-                public DocValuesType? DocValueType
+                public DocValuesType DocValueType
                 {
-                    get { return null; }
+                    get { return DocValuesType.NONE; }
                 }
             }
 

Reply via email to