Lucene.Net.Core.Search.Similarities.BM25Similarity: Changed sbyte to byte for 
CLS compliance.


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

Branch: refs/heads/api-work
Commit: 8385761438631b704e5ad9aa346cd194120d20a7
Parents: 36494af
Author: Shad Storhaug <[email protected]>
Authored: Wed Mar 1 12:34:50 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Wed Mar 1 22:47:48 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/83857614/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs 
b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
index 584640b..a646740 100644
--- a/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
+++ b/src/Lucene.Net.Core/Search/Similarities/BM25Similarity.cs
@@ -106,16 +106,16 @@ namespace Lucene.Net.Search.Similarities
         /// Lucene's default implementation.  If you change this, then you 
should
         /// change <seealso cref="#decodeNormValue(byte)"/> to match.
         /// </summary>
-        protected internal virtual sbyte EncodeNormValue(float boost, int 
fieldLength) // LUCENENET TODO: Can we use byte?
+        protected internal virtual byte EncodeNormValue(float boost, int 
fieldLength) 
         {
-            return SmallSingle.SingleToSByte315(boost / 
(float)Math.Sqrt(fieldLength));
+            return SmallSingle.SingleToByte315(boost / 
(float)Math.Sqrt(fieldLength));
         }
 
         /// <summary>
         /// The default implementation returns <code>1 / f<sup>2</sup></code>
         /// where <code>f</code> is <seealso 
cref="SmallSingle#byte315ToFloat(byte)"/>.
         /// </summary>
-        protected internal virtual float DecodeNormValue(sbyte b) // LUCENENET 
TODO: Can we use byte?
+        protected internal virtual float DecodeNormValue(byte b)
         {
             return NORM_TABLE[b & 0xFF];
         }
@@ -230,7 +230,7 @@ namespace Lucene.Net.Search.Similarities
             float[] cache = new float[256];
             for (int i = 0; i < cache.Length; i++)
             {
-                cache[i] = k1 * ((1 - b) + b * DecodeNormValue((sbyte)i) / 
avgdl);
+                cache[i] = k1 * ((1 - b) + b * DecodeNormValue((byte)i) / 
avgdl);
             }
             return new BM25Stats(collectionStats.Field, idf, queryBoost, 
avgdl, cache);
         }
@@ -362,7 +362,7 @@ namespace Lucene.Net.Search.Similarities
             }
             else
             {
-                float doclen = DecodeNormValue((sbyte)norms.Get(doc));
+                float doclen = DecodeNormValue((byte)norms.Get(doc));
                 tfNormExpl.AddDetail(new Explanation(b, "parameter b"));
                 tfNormExpl.AddDetail(new Explanation(stats.Avgdl, 
"avgFieldLength"));
                 tfNormExpl.AddDetail(new Explanation(doclen, "fieldLength"));

Reply via email to