You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2019/09/06 09:01:22 UTC

[lucenenet] 12/21: Lucene.Net.Facet: Changed string to number conversion to use invariant culture

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 58fe6d2df3db85d59f6d7cf4db926a78267558bb
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Sep 3 12:51:55 2019 +0700

    Lucene.Net.Facet: Changed string to number conversion to use invariant culture
---
 src/Lucene.Net.Facet/FacetResult.cs                                | 1 -
 src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Facet/FacetResult.cs b/src/Lucene.Net.Facet/FacetResult.cs
index bd29d82..294d2f5 100644
--- a/src/Lucene.Net.Facet/FacetResult.cs
+++ b/src/Lucene.Net.Facet/FacetResult.cs
@@ -112,7 +112,6 @@ namespace Lucene.Net.Facet
             else
             {
                 sb.AppendFormat(CultureInfo.InvariantCulture, "{0:0.0#####}", Value); // Decimal formatting
-                //sb.Append(Number.ToString(Value)); // LUCENENET TODO: Decimal formatting causing a Demo test to fail because of double formatting inaccuracy
             }
             sb.Append(" childCount=");
             sb.Append(ChildCount);
diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs
index 9b6bd7e..3e68f0a 100644
--- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyReader.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Text;
 
@@ -331,7 +332,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory
 
                 // LUCENENET: Lock was removed here because the underlying cache is thread-safe,
                 // and removing the lock seems to make the performance better.
-                ordinalCache.Put(cp, new Int32Class { Value = Convert.ToInt32(ret) });
+                ordinalCache.Put(cp, new Int32Class { Value = Convert.ToInt32(ret, CultureInfo.InvariantCulture) });
             }
 
             return ret;