lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [11/50] [abbrv] lucenenet git commit: SWEEP: Lucene.Net.Codecs: Changed all IndexOptions comparisons to use IndexOptions.GetValueOrDefault() in case the value is null
Date Sun, 05 Mar 2017 11:48:50 GMT
SWEEP: Lucene.Net.Codecs: Changed all IndexOptions comparisons to use IndexOptions.GetValueOrDefault()
in case the value is null


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

Branch: refs/heads/api-work
Commit: 5704f3ba299a9746c4ae456efdbed506c6f40ea0
Parents: ef912b0
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Mar 3 10:46:45 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Mar 5 17:08:32 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs    |  6 +++---
 src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs       |  6 +++---
 src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs          |  6 +++---
 src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs    | 12 ++++++------
 src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs  |  6 +++---
 .../SimpleText/SimpleTextFieldsReader.cs                |  6 +++---
 6 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5704f3ba/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 349cab1..d53d2c9 100644
--- a/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/DirectPostingsFormat.cs
@@ -405,9 +405,9 @@ namespace Lucene.Net.Codecs.Memory
 
                 this.minSkipCount = minSkipCount;
 
-                hasFreq = fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_ONLY)
> 0;
-                hasPos = fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS)
> 0;
-                hasOffsets_Renamed = fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
> 0;
+                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;
 
                 BytesRef term;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5704f3ba/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 ac5633e..b30c10c 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs
@@ -252,17 +252,17 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasFreqs
             {
-                get { return fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS)
>= 0; } // LUCENENET TODO: Possible exception if IndexOptions is null
+                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS)
>= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0; } // LUCENENET TODO: Possible exception if IndexOptions is null
+                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0; } // LUCENENET TODO: Possible exception if IndexOptions is null
+                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0; }
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5704f3ba/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 af00287..efec421 100644
--- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
+++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs
@@ -221,17 +221,17 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasFreqs
             {
-                get{ return fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS)
>= 0; }
+                get{ return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS)
>= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0; }
+                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return fieldInfo.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0; }
+                get { return fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0; }
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5704f3ba/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 752e870..4b86aff 100644
--- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
+++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs
@@ -198,7 +198,7 @@ namespace Lucene.Net.Codecs.Memory
                         buffer.WriteVInt32(delta);
                     }
 
-                    if (outerInstance.field.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0)
+                    if (outerInstance.field.IndexOptions.GetValueOrDefault().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.
@@ -845,8 +845,8 @@ namespace Lucene.Net.Codecs.Memory
 
             public override DocsAndPositionsEnum DocsAndPositions(IBits liveDocs, DocsAndPositionsEnum
reuse, int flags)
             {
-                bool hasOffsets = field.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0;
-                if (field.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
< 0)
+                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)
                 {
                     return null;
                 }
@@ -1002,17 +1002,17 @@ namespace Lucene.Net.Codecs.Memory
 
             public override bool HasFreqs
             {
-                get { return field.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS)
>= 0; } // LUCENENET TODO: Possible exception if IndexOptions is null
+                get { return field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS)
>= 0; }
             }
 
             public override bool HasOffsets
             {
-                get { return field.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0; } // LUCENENET TODO: Possible exception if IndexOptions is null
+                get { return field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0; }
             }
 
             public override bool HasPositions
             {
-                get { return field.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0; } // LUCENENET TODO: Possible exception if IndexOptions is null
+                get { return field.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0; }
             }
 
             public override bool HasPayloads

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5704f3ba/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 d49d246..675bb1f 100644
--- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
+++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs
@@ -332,7 +332,7 @@ namespace Lucene.Net.Codecs.Pulsing
             {
                 _indexOptions = fieldInfo.IndexOptions;
                 _storePayloads = fieldInfo.HasPayloads;
-                _storeOffsets = _indexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0;
+                _storeOffsets = _indexOptions.GetValueOrDefault().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.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0)
+                        if (_indexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0)
                         {
                             // Skip positions
                             if (_storePayloads)
@@ -476,7 +476,7 @@ namespace Lucene.Net.Codecs.Pulsing
                 _indexOptions = fieldInfo.IndexOptions;
                 _storePayloads = fieldInfo.HasPayloads;
                 _storeOffsets =
-                    _indexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
>= 0;
+                    _indexOptions.GetValueOrDefault().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/5704f3ba/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 0342ed2..f1bec4e 100644
--- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
+++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs
@@ -707,20 +707,20 @@ namespace Lucene.Net.Codecs.SimpleText
 
             public override bool HasFreqs
             {
-                get { return _fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS)
>= 0; } // LUCENENET TODO: Possible exception when IndexOptions is null
+                get { return _fieldInfo.IndexOptions.GetValueOrDefault().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; // LUCENENET TODO: Possible exception when IndexOptions is null
+                    return _fieldInfo.IndexOptions.GetValueOrDefault().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; } // LUCENENET TODO: Possible exception when IndexOptions is null
+                get { return _fieldInfo.IndexOptions.GetValueOrDefault().CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS)
>= 0; } 
             }
 
             public override bool HasPayloads


Mime
View raw message