lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r885207 - /incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/SortField.cs
Date Sun, 29 Nov 2009 09:18:42 GMT
Author: digy
Date: Sun Nov 29 09:18:42 2009
New Revision: 885207

URL: http://svn.apache.org/viewvc?rev=885207&view=rev
Log:
LUCENENET-312 TestDateSort.TestReverseDateSort

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

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/SortField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/SortField.cs?rev=885207&r1=885206&r2=885207&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/SortField.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/SortField.cs Sun Nov 29 09:18:42 2009
@@ -645,32 +645,12 @@
 				if ((System.Object) term.Field() == (System.Object) field)
 				{
 					System.String termtext = term.Text().Trim();
-					
-					try
-					{
-						System.Int32.Parse(termtext);
-						ret = SortField.INT;
-					}
-					catch (System.FormatException nfe1)
-					{
-						try
-						{
-							System.Int64.Parse(termtext);
-							ret = SortField.LONG;
-						}
-						catch (System.FormatException nfe2)
-						{
-							try
-							{
-                                SupportClass.Single.Parse(termtext);
-								ret = SortField.FLOAT;
-							}
-							catch (System.FormatException nfe3)
-							{
-								ret = SortField.STRING;
-							}
-						}
-					}
+                    
+                    int tmpI32; long tmpI64; float tmpF;
+                    if      (System.Int32.TryParse(termtext, out tmpI32))       ret = SortField.INT;
+                    else if (System.Int64.TryParse(termtext, out tmpI64))       ret = SortField.LONG;
+                    else if (SupportClass.Single.TryParse(termtext, out tmpF))  ret = SortField.FLOAT;
+                    else ret = SortField.STRING;
 				}
 				else
 				{



Mime
View raw message