lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject git commit: LUCENENET-533 StringValue of NumberField is localized
Date Fri, 21 Feb 2014 11:08:26 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master b568cb505 -> e3beba717


LUCENENET-533 StringValue of NumberField is localized


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

Branch: refs/heads/master
Commit: e3beba71755602a2c99be20d235c4bfef44b5be9
Parents: b568cb5
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Fri Feb 21 12:52:31 2014 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Fri Feb 21 12:52:31 2014 +0200

----------------------------------------------------------------------
 src/core/Document/NumericField.cs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e3beba71/src/core/Document/NumericField.cs
----------------------------------------------------------------------
diff --git a/src/core/Document/NumericField.cs b/src/core/Document/NumericField.cs
index 3358670..214f357 100644
--- a/src/core/Document/NumericField.cs
+++ b/src/core/Document/NumericField.cs
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Globalization;
 using System.IO;
 using Lucene.Net.Search;
 using NumericTokenStream = Lucene.Net.Analysis.NumericTokenStream;
@@ -230,7 +231,13 @@ namespace Lucene.Net.Documents
         /// <summary>Returns the numeric value as a string (how it is stored, when
<see cref="Field.Store.YES" /> is chosen). </summary>
         public override string StringValue
         {
-            get { return (fieldsData == null) ? null : fieldsData.ToString(); }
+            get
+            {
+                if (fieldsData == null) return null;
+                var fd = fieldsData as IConvertible;
+                if (fd != null) return fd.ToString(CultureInfo.InvariantCulture);
+                return fieldsData.ToString();
+            }
         }
 
         /// <summary>Returns the current numeric value as a subclass of <see cref="Number"
/>, <c>null</c> if not yet initialized. </summary>


Mime
View raw message