lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [01/10] lucenenet git commit: Fixed Regex bugs in the Analysis.Synonym.TestSynonymMapFilter that were causing 14 failing tests.
Date Sun, 02 Oct 2016 15:02:27 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master 0ab847b28 -> 87d05125b


Fixed Regex bugs in the Analysis.Synonym.TestSynonymMapFilter that were causing 14 failing
tests.


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

Branch: refs/heads/master
Commit: bf7c2b4d3eb3e120b0159e13d3787a77f239af5a
Parents: 0ab847b
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Sep 22 10:06:56 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Oct 2 21:43:57 2016 +0700

----------------------------------------------------------------------
 .../Analysis/Synonym/TestSynonymMapFilter.cs                 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/bf7c2b4d/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
index 30b723a..0d92df5 100644
--- a/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
+++ b/src/Lucene.Net.Tests.Analysis.Common/Analysis/Synonym/TestSynonymMapFilter.cs
@@ -8,6 +8,7 @@ using System.Collections.Generic;
 using System.Diagnostics;
 using System.IO;
 using System.Text;
+using System.Text.RegularExpressions;
 
 namespace Lucene.Net.Analysis.Synonym
 {
@@ -39,17 +40,20 @@ namespace Lucene.Net.Analysis.Synonym
         private IPositionLengthAttribute posLenAtt;
         private IOffsetAttribute offsetAtt;
 
+        private static Regex space = new Regex(" +", RegexOptions.Compiled);
+
         private void Add(string input, string output, bool keepOrig)
         {
             if (VERBOSE)
             {
                 Console.WriteLine("  add input=" + input + " output=" + output + " keepOrig="
+ keepOrig);
             }
+
             CharsRef inputCharsRef = new CharsRef();
-            SynonymMap.Builder.Join(input.Split(new string[] { " +" }, StringSplitOptions.RemoveEmptyEntries),
inputCharsRef);
+            SynonymMap.Builder.Join(space.Split(input), inputCharsRef);
 
             CharsRef outputCharsRef = new CharsRef();
-            SynonymMap.Builder.Join(output.Split(new string[] { " +" }, StringSplitOptions.RemoveEmptyEntries),
outputCharsRef);
+            SynonymMap.Builder.Join(space.Split(output), outputCharsRef);
 
             b.Add(inputCharsRef, outputCharsRef, keepOrig);
         }


Mime
View raw message