BUG: Lucene.Net.QueryParser.Classic.QueryParserBase: Fixed fuzzy slop parsing 
to use invariant culture


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

Branch: refs/heads/api-work
Commit: 7d22b2e2c75f01a6bd3f2e95dfabeab3edee023a
Parents: a57c8e6
Author: Shad Storhaug <[email protected]>
Authored: Wed Mar 8 01:12:30 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Wed Mar 8 16:56:42 2017 +0700

----------------------------------------------------------------------
 .../Classic/QueryParserBase.cs                  | 21 ++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/7d22b2e2/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs 
b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
index 0fed97f..a919140 100644
--- a/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
+++ b/src/Lucene.Net.QueryParser/Classic/QueryParserBase.cs
@@ -837,7 +837,15 @@ namespace Lucene.Net.QueryParsers.Classic
             float fms = FuzzyMinSim;
             try
             {
-                fms = float.Parse(fuzzySlop.Image.Substring(1), Locale);
+                // LUCENENET NOTE: Apparently a "feature" of Lucene is to 
always
+                // use "." as the decimal specifier for fuzzy slop, even if 
the culture uses
+                // a different one, such as ",".
+
+                // LUCENENET TODO: It would probably be more intuitive to use
+                // the current Locale to specify the decimal identifier than
+                // to hard code it to be ".", but this would differ from Java 
Lucene.
+                // Perhaps just make it a non-default option?
+                fms = float.Parse(fuzzySlop.Image.Substring(1), 
CultureInfo.InvariantCulture);
             }
             catch (Exception /*ignored*/) { }
             if (fms < 0.0f)
@@ -860,7 +868,15 @@ namespace Lucene.Net.QueryParsers.Classic
             {
                 try
                 {
-                    s = (int)float.Parse(fuzzySlop.Image.Substring(1), Locale);
+                    // LUCENENET NOTE: Apparently a "feature" of Lucene is to 
always
+                    // use "." as the decimal specifier for fuzzy slop, even 
if the culture uses
+                    // a different one, such as ",".
+
+                    // LUCENENET TODO: It would probably be more intuitive to 
use
+                    // the current Locale to specify the decimal identifier 
than
+                    // to hard code it to be ".", but this would differ from 
Java Lucene.
+                    // Perhaps just make it a non-default option?
+                    s = (int)float.Parse(fuzzySlop.Image.Substring(1), 
CultureInfo.InvariantCulture);
                 }
                 catch (Exception /*ignored*/) { }
             }
@@ -882,6 +898,7 @@ namespace Lucene.Net.QueryParsers.Classic
                     // LUCENENET TODO: It would probably be more intuitive to 
use
                     // the current Locale to specify the decimal identifier 
than
                     // to hard code it to be ".", but this would differ from 
Java Lucene.
+                    // Perhaps just make it a non-default option?
                     f = float.Parse(boost.Image, CultureInfo.InvariantCulture);
                 }
                 catch (Exception /*ignored*/)

Reply via email to