lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aro...@apache.org
Subject svn commit: r568813 - in /incubator/lucene.net/trunk/C#/src/Lucene.Net: QueryParser/QueryParser.cs Search/ConstantScoreRangeQuery.cs Search/FuzzyQuery.cs SupportClass.cs Util/ToStringUtils.cs
Date Thu, 23 Aug 2007 03:37:08 GMT
Author: aroush
Date: Wed Aug 22 20:37:07 2007
New Revision: 568813

URL: http://svn.apache.org/viewvc?rev=568813&view=rev
Log:
Fix: LUCENENET-87 "NUnite test for TestQueryParser"

Modified:
    incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FuzzyQuery.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/SupportClass.cs
    incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/QueryParser/QueryParser.cs?rev=568813&r1=568812&r2=568813&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs Wed Aug 22 20:37:07
2007
@@ -1173,7 +1173,7 @@
 				float f = (float) 1.0;
 				try
 				{
-					f = (float) System.Single.Parse(boost.image);
+                    f = (float) SupportClass.Single.Parse(boost.image);
 					q.SetBoost(f);
 				}
 				catch (System.Exception ignored)
@@ -1291,8 +1291,7 @@
 						float fms = fuzzyMinSim;
 						try
 						{
-							fms = (float) System.Single.Parse(fuzzySlop.image.Substring(1).Replace(".", 
-								System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator));
+                            fms = (float) SupportClass.Single.Parse(fuzzySlop.image.Substring(1));
                         }
 						catch (System.Exception ignored)
 						{
@@ -1498,7 +1497,7 @@
 					{
 						try
 						{
-							s = (int) System.Single.Parse(fuzzySlop.image.Substring(1));
+                            s = (int) SupportClass.Single.Parse(fuzzySlop.image.Substring(1));
 						}
 						catch (System.Exception ignored)
 						{
@@ -1518,7 +1517,7 @@
 				float f = (float) 1.0;
 				try
 				{
-					f = (float) System.Single.Parse(boost.image);
+                    f = (float) SupportClass.Single.Parse(boost.image);
 				}
 				catch (System.Exception ignored)
 				{

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs?rev=568813&r1=568812&r2=568813&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs Wed Aug
22 20:37:07 2007
@@ -121,11 +121,7 @@
 			buffer.Append(" TO ");
 			buffer.Append(upperVal != null ? upperVal : "*");
 			buffer.Append(includeUpper ? ']' : '}');
-			if (GetBoost() != 1.0f)
-			{
-				buffer.Append("^");
-				buffer.Append(GetBoost().ToString());
-			}
+            buffer.Append(Lucene.Net.Util.ToStringUtils.Boost(GetBoost()));
 			return buffer.ToString();
 		}
 		

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FuzzyQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Search/FuzzyQuery.cs?rev=568813&r1=568812&r2=568813&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FuzzyQuery.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FuzzyQuery.cs Wed Aug 22 20:37:07
2007
@@ -159,7 +159,7 @@
 			}
 			buffer.Append(term.Text());
 			buffer.Append('~');
-			buffer.Append(minimumSimilarity.ToString());
+			buffer.Append(SupportClass.Single.ToString(minimumSimilarity));
 			buffer.Append(ToStringUtils.Boost(GetBoost()));
 			return buffer.ToString();
 		}

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=568813&r1=568812&r2=568813&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 22 20:37:07 2007
@@ -658,6 +658,27 @@
                 throw fex;					
             }
         }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="f"></param>
+        /// <returns></returns>
+        public static string ToString(float f)
+        {
+            return f.ToString().Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
".");
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="f"></param>
+        /// <param name="format"></param>
+        /// <returns></returns>
+        public static string ToString(float f, string format)
+        {
+            return f.ToString(format).Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
".");
+        }
     }
 
     /// <summary>

Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/ToStringUtils.cs?rev=568813&r1=568812&r2=568813&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs Wed Aug 22 20:37:07
2007
@@ -28,8 +28,8 @@
             {
                 float boostAsLong = (long) boost;
                 if (boostAsLong == boost)
-                    return "^" + boost.ToString(".0");
-                return "^" + boost.ToString();
+                    return "^" + boost.ToString(".0").Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
".");
+                return "^" + boost.ToString().Replace(System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator,
".");
             }
             else
                 return "";



Mime
View raw message