lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r718683 - in /incubator/lucene.net/trunk/C#/src/Lucene.Net: Search/ExtendedFieldCacheImpl.cs SupportClass.cs
Date Tue, 18 Nov 2008 18:54:11 GMT
Author: digy
Date: Tue Nov 18 10:54:10 2008
New Revision: 718683

URL: http://svn.apache.org/viewvc?rev=718683&view=rev
Log:
LUCENENET-160 (A small performance improvement in ExtendedFieldCacheImpl)

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=718683&r1=718682&r2=718683&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 Tue Nov
18 10:54:10 2008
@@ -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);
                                 }
@@ -298,4 +298,4 @@
 			DOUBLE_PARSER = new AnonymousClassDoubleParser();
 		}
 	}
-}
\ No newline at end of file
+}

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=718683&r1=718682&r2=718683&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs Tue Nov 18 10:54:10 2008
@@ -764,6 +764,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