lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [10/10] lucenenet git commit: Fixed several CharArraySet/CharArrayMap bugs that were causing tests to fail, and re-enabled those tests. Refactored both classes to be more .NET-like.
Date Sun, 02 Oct 2016 15:02:36 GMT
Fixed several CharArraySet/CharArrayMap bugs that were causing tests to fail, and re-enabled
those tests. Refactored both classes to be more .NET-like.


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

Branch: refs/heads/master
Commit: 87d05125bb8d3df1bbe2b42bd6893b7d123b0b28
Parents: 67cf947
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Sep 30 20:24:41 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Oct 2 21:44:10 2016 +0700

----------------------------------------------------------------------
 .../Analysis/Core/StopFilter.cs                 |    4 +-
 .../CapitalizationFilterFactory.cs              |    2 +-
 .../Analysis/Nl/DutchAnalyzer.cs                |    6 +-
 .../Analysis/Nl/DutchStemFilter.cs              |    2 +-
 .../Analysis/Nl/DutchStemmer.cs                 |    4 +-
 .../Analysis/Util/AbstractAnalysisFactory.cs    |    2 +-
 .../Analysis/Util/CharArrayMap.cs               | 2867 ++++++++++++++----
 .../Analysis/Util/CharArraySet.cs               | 1294 +++++++-
 .../Analysis/Core/TestBugInSomething.cs         |    2 +-
 .../Analysis/Util/TestCharArrayMap.cs           |   88 +-
 .../Analysis/Util/TestCharArraySet.cs           |  299 +-
 11 files changed, 3851 insertions(+), 719 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87d05125/src/Lucene.Net.Analysis.Common/Analysis/Core/StopFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Core/StopFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Core/StopFilter.cs
index 2896988..1979960 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Core/StopFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Core/StopFilter.cs
@@ -101,7 +101,7 @@ namespace Lucene.Net.Analysis.Core
         public static CharArraySet MakeStopSet(LuceneVersion matchVersion, string[] stopWords,
bool ignoreCase)
         {
             CharArraySet stopSet = new CharArraySet(matchVersion, stopWords.Length, ignoreCase);
-            stopSet.AddAll(Arrays.AsList(stopWords));
+            stopSet.UnionWith(stopWords);
             return stopSet;
         }
 
@@ -114,7 +114,7 @@ namespace Lucene.Net.Analysis.Core
         public static CharArraySet MakeStopSet<T1>(LuceneVersion matchVersion, IEnumerable<T1>
stopWords, bool ignoreCase)
         {
             var stopSet = new CharArraySet(matchVersion, stopWords.Count(), ignoreCase);
-            stopSet.AddAll(stopWords.Cast<object>().ToArray());
+            stopSet.UnionWith(stopWords);
             return stopSet;
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87d05125/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs
b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs
index 315d417..eccc9cb 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/CapitalizationFilterFactory.cs
@@ -81,7 +81,7 @@ namespace Lucene.Net.Analysis.Miscellaneous
             if (k != null)
             {
                 keep = new CharArraySet(luceneMatchVersion, 10, ignoreCase);
-                keep.AddAll(k);
+                keep.UnionWith(k);
             }
 
             k = GetSet(args, OK_PREFIX);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87d05125/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs
index 1c54b05..7f16dce 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchAnalyzer.cs
@@ -164,7 +164,7 @@ namespace Lucene.Net.Analysis.Nl
 #pragma warning restore 612, 618
             {
                 this.stemdict = null;
-                this.origStemdict = CharArrayMap<string>.UnmodifiableMap(CharArrayMap<string>.Copy(matchVersion,
stemOverrideDict));
+                this.origStemdict = CharArrayMap.UnmodifiableMap(CharArrayMap.Copy(matchVersion,
stemOverrideDict));
             }
             else
             {
@@ -173,11 +173,11 @@ namespace Lucene.Net.Analysis.Nl
                 StemmerOverrideFilter.Builder builder = new StemmerOverrideFilter.Builder(false);
                 CharArrayMap<string>.EntryIterator iter = (CharArrayMap<string>.EntryIterator)stemOverrideDict.EntrySet().GetEnumerator();
                 CharsRef spare = new CharsRef();
-                while (iter.HasNext())
+                while (iter.HasNext)
                 {
                     char[] nextKey = iter.NextKey();
                     spare.CopyChars(nextKey, 0, nextKey.Length);
-                    builder.Add(new string(spare.Chars), iter.CurrentValue());
+                    builder.Add(new string(spare.Chars), iter.CurrentValue);
                 }
                 try
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87d05125/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
index bed9091..3c73269 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemFilter.cs
@@ -57,7 +57,7 @@ namespace Lucene.Net.Analysis.Nl
         }
 
         /// <param name="stemdictionary"> Dictionary of word stem pairs, that overrule
the algorithm </param>
-        public DutchStemFilter(TokenStream _in, IDictionary<object, string> stemdictionary)
: this(_in)
+        public DutchStemFilter(TokenStream _in, IDictionary<string, string> stemdictionary)
: this(_in)
         {
             stemmer.StemDictionary = stemdictionary;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87d05125/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
index 03cccde..55de129 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Nl/DutchStemmer.cs
@@ -41,7 +41,7 @@ namespace Lucene.Net.Analysis.Nl
         /// </summary>
         private StringBuilder sb = new StringBuilder();
         private bool _removedE;
-        private IDictionary<object, string> _stemDict;
+        private IDictionary<string, string> _stemDict;
 
         private int _R1;
         private int _R2;
@@ -464,7 +464,7 @@ namespace Lucene.Net.Analysis.Nl
             return false;
         }
 
-        internal virtual IDictionary<object, string> StemDictionary
+        internal virtual IDictionary<string, string> StemDictionary
         {
             set
             {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/87d05125/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
index 7992094..a3ad814 100644
--- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
+++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AbstractAnalysisFactory.cs
@@ -312,7 +312,7 @@ namespace Lucene.Net.Analysis.Util
                 foreach (string file in files)
                 {
                     var wlist = GetLines(loader, file.Trim());
-                    words.AddAll(StopFilter.MakeStopSet(luceneMatchVersion, wlist, ignoreCase));
+                    words.UnionWith(StopFilter.MakeStopSet(luceneMatchVersion, wlist, ignoreCase));
                 }
             }
             return words;


Mime
View raw message