lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [10/50] [abbrv] lucenenet git commit: Fixed bug in Lucene.Net.Util.ToStringUtils that was causing issues with the QueryParser tests. Rolled the Boost(float) method back to the Lucene.Net 3.0.3 state.
Date Sun, 11 Sep 2016 21:30:41 GMT
Fixed bug in Lucene.Net.Util.ToStringUtils that was causing issues with the QueryParser tests.
Rolled the Boost(float) method back to the Lucene.Net 3.0.3 state.


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

Branch: refs/heads/master
Commit: 1937dda38914c032f204cdf23b91157246a63de5
Parents: 11ecedc
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Jul 31 21:37:32 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Sep 2 22:30:15 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Core/Util/ToStringUtils.cs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1937dda3/src/Lucene.Net.Core/Util/ToStringUtils.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/ToStringUtils.cs b/src/Lucene.Net.Core/Util/ToStringUtils.cs
index d3d97c4..e5f5a0d 100644
--- a/src/Lucene.Net.Core/Util/ToStringUtils.cs
+++ b/src/Lucene.Net.Core/Util/ToStringUtils.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Globalization;
 using System.Text;
 
 namespace Lucene.Net.Util
@@ -36,12 +37,13 @@ namespace Lucene.Net.Util
         {
             if (boost != 1.0f)
             {
-                return "^" + Convert.ToString(boost);
+                float boostAsLong = (long)boost;
+                if (boostAsLong == boost)
+                    return "^" + boost.ToString(".0").Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
".");
+                return "^" + boost.ToString().Replace(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
".");
             }
             else
-            {
                 return "";
-            }
         }
 
         public static void ByteArray(StringBuilder buffer, byte[] bytes)


Mime
View raw message