lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [lucenenet] 04/07: Lucene.Net.Support.Number: Factored out ToString(long) in favor of long.ToString(CultureInfo.InvariantCulture)
Date Sun, 15 Dec 2019 11:44:53 GMT
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit dfdf7088707d13aeb7379c28de58b37d74b5555b
Author: Shad Storhaug <shad@shadstorhaug.com>
AuthorDate: Thu Dec 5 22:42:34 2019 +0700

    Lucene.Net.Support.Number: Factored out ToString(long) in favor of long.ToString(CultureInfo.InvariantCulture)
---
 .../TestPostingsHighlighterRanking.cs              |  2 +-
 src/Lucene.Net/Support/Number.cs                   | 32 ----------------------
 .../TestICUPostingsHighlighterRanking.cs           |  2 +-
 3 files changed, 2 insertions(+), 34 deletions(-)

diff --git a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
index 16690ac..b40f913 100644
--- a/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
+++ b/src/Lucene.Net.Tests.Highlighter/PostingsHighlight/TestPostingsHighlighterRanking.cs
@@ -140,7 +140,7 @@ namespace Lucene.Net.Search.PostingsHighlight
 
                 BooleanQuery bq = new BooleanQuery(false);
                 bq.Add(query, Occur.MUST);
-                bq.Add(new TermQuery(new Term("id", Number.ToString(doc))), Occur.MUST);
+                bq.Add(new TermQuery(new Term("id", doc.ToString(CultureInfo.InvariantCulture))),
Occur.MUST);
                 TopDocs td = @is.Search(bq, 1);
                 p1.Highlight("body", bq, @is, td, n);
                 p2.Highlight("body", bq, @is, td, n + 1);
diff --git a/src/Lucene.Net/Support/Number.cs b/src/Lucene.Net/Support/Number.cs
index 0f4b5f1..f474730 100644
--- a/src/Lucene.Net/Support/Number.cs
+++ b/src/Lucene.Net/Support/Number.cs
@@ -47,38 +47,6 @@ namespace Lucene.Net.Support
         /// <summary>
         /// Converts a number to System.String.
         /// </summary>
-        /// <param name="number"></param>
-        /// <returns></returns>
-        public static string ToString(long number)
-        {
-            var s = new System.Text.StringBuilder();
-
-            if (number == 0)
-            {
-                s.Append("0");
-            }
-            else
-            {
-                if (number < 0)
-                {
-                    s.Append("-");
-                    number = -number;
-                }
-
-                while (number > 0)
-                {
-                    char c = digits[(int)number % 36];
-                    s.Insert(0, c);
-                    number = number / 36;
-                }
-            }
-
-            return s.ToString();
-        }
-
-        /// <summary>
-        /// Converts a number to System.String.
-        /// </summary>
         /// <param name="f"></param>
         /// <returns></returns>
         public static System.String ToString(float f)
diff --git a/src/dotnet/Lucene.Net.Tests.ICU/Search/PostingsHighlight/TestICUPostingsHighlighterRanking.cs
b/src/dotnet/Lucene.Net.Tests.ICU/Search/PostingsHighlight/TestICUPostingsHighlighterRanking.cs
index cdd74ef..f39514f 100644
--- a/src/dotnet/Lucene.Net.Tests.ICU/Search/PostingsHighlight/TestICUPostingsHighlighterRanking.cs
+++ b/src/dotnet/Lucene.Net.Tests.ICU/Search/PostingsHighlight/TestICUPostingsHighlighterRanking.cs
@@ -139,7 +139,7 @@ namespace Lucene.Net.Search.PostingsHighlight
 
                 BooleanQuery bq = new BooleanQuery(false);
                 bq.Add(query, Occur.MUST);
-                bq.Add(new TermQuery(new Term("id", Number.ToString(doc))), Occur.MUST);
+                bq.Add(new TermQuery(new Term("id", doc.ToString(CultureInfo.InvariantCulture))),
Occur.MUST);
                 TopDocs td = @is.Search(bq, 1);
                 p1.Highlight("body", bq, @is, td, n);
                 p2.Highlight("body", bq, @is, td, n + 1);


Mime
View raw message