lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r801310 - in /incubator/lucene.net/trunk/C#/src/Lucene.Net: Search/ExtendedFieldCacheImpl.cs SupportClass.cs
Date Wed, 05 Aug 2009 17:10:54 GMT
Author: digy
Date: Wed Aug  5 17:10:54 2009
New Revision: 801310

URL: http://svn.apache.org/viewvc?rev=801310&view=rev
Log:
LUCENENET-160 for Lucene.Net 2.4.0

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ExtendedFieldCacheImpl.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ExtendedFieldCacheImpl.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/ExtendedFieldCacheImpl.cs?rev=801310&r1=801309&r2=801310&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ExtendedFieldCacheImpl.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ExtendedFieldCacheImpl.cs Wed Aug
 5 17:10:54 2009
@@ -218,12 +218,12 @@
                             }
                             else
                             {
-                                try
+                                float f = 0.0f;
+                                if (SupportClass.Single.TryParse(termtext, out f))
                                 {
-                                    SupportClass.Single.Parse(termtext);
                                     ret = Enclosing_Instance.GetFloats(reader, field);
                                 }
-                                catch (System.FormatException)
+                                else
                                 {
                                     ret = Enclosing_Instance.GetStringIndex(reader, field);
                                 }

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/SupportClass.cs?rev=801310&r1=801309&r2=801310&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs Wed Aug  5 17:10:54 2009
@@ -693,7 +693,7 @@
 
             return s.ToString();
         }
-
+           
 
         /// <summary>
         /// Converts a number to System.String.
@@ -1059,6 +1059,18 @@
             }
         }
 
+        public static bool TryParse(System.String s, out float f)
+        {
+            bool ok = false;
+
+            if (s.EndsWith("f") || s.EndsWith("F"))
+                ok = System.Single.TryParse(s.Substring(0, s.Length - 1).Replace(".", System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator),
out f);
+            else
+                ok = System.Single.TryParse(s.Replace(".", System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator),
out f);
+
+            return ok;
+        }
+
         /// <summary>
         /// 
         /// </summary>



Mime
View raw message