You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by di...@apache.org on 2011/05/07 20:03:36 UTC
[Lucene.Net] svn commit: r1100581 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g:
src/core/Analysis/ src/core/Analysis/Standard/ test/core/Analysis/
test/core/Index/ test/core/QueryParser/ test/core/Search/
test/core/Search/Spans/ test/core/Store/
Author: digy
Date: Sat May 7 18:03:36 2011
New Revision: 1100581
URL: http://svn.apache.org/viewvc?rev=1100581&view=rev
Log:
[LUCENENET-412] This is the first point where we loose "drop-in replacement"
stopWords are now "List<string>" not "Hashtable".
So the new API is like stopWords.Add("this") ( was stopWords.Add("this","this") which I have hated in Lucene.Net most)
Modified:
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/CharArraySet.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Standard/StandardAnalyzer.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopAnalyzer.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopFilter.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/WordlistLoader.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestCharArraySet.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopAnalyzer.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopFilter.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestWordlistLoader.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/QueryParser/TestQueryParser.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/Spans/TestSpans.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/TestMultiPhraseQuery.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestWindowsMMap.cs
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/CharArraySet.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/CharArraySet.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/CharArraySet.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/CharArraySet.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,8 @@
*/
using System;
+using System.Collections.Generic;
+
namespace Lucene.Net.Analysis
{
@@ -29,9 +31,9 @@ namespace Lucene.Net.Analysis
/// to a String first.
/// </summary>
- public class CharArraySet:System.Collections.Hashtable
+ public class CharArraySet : List<string> //:System.Collections.Hashtable
{
- public override int Count
+ public new int Count
{
get
{
@@ -72,7 +74,22 @@ namespace Lucene.Net.Analysis
this.ignoreCase = ignoreCase;
this.count = count;
}
-
+
+ public bool Contains(object o)
+ {
+ if (o is char[])
+ {
+ char[] text = (char[])o;
+ return Contains(text, 0, text.Length);
+ }
+ return Contains(o.ToString());
+ }
+
+ public virtual bool Contains(char[] text)
+ {
+ return Contains(text, 0, text.Length);
+ }
+
/// <summary>true if the <code>len</code> chars of <code>text</code> starting at <code>off</code>
/// are in the set
/// </summary>
@@ -127,7 +144,7 @@ namespace Lucene.Net.Analysis
}
/// <summary>Add this String into the set </summary>
- public virtual bool Add(System.String text)
+ public new virtual bool Add(System.String text)
{
return Add(text.ToCharArray());
}
@@ -271,16 +288,6 @@ namespace Lucene.Net.Analysis
return count == 0;
}
- public override bool Contains(System.Object o)
- {
- if (o is char[])
- {
- char[] text = (char[]) o;
- return Contains(text, 0, text.Length);
- }
- return Contains(o.ToString());
- }
-
public virtual bool Add(System.Object o)
{
if (o is char[])
@@ -288,9 +295,9 @@ namespace Lucene.Net.Analysis
return Add((char[]) o);
}
- if (o is System.Collections.Hashtable)
+ if (o is List<string>)
{
- foreach (string word in ((System.Collections.Hashtable)o).Keys)
+ foreach (string word in o as List<string>)
{
Add(word);
}
@@ -410,12 +417,7 @@ namespace Lucene.Net.Analysis
{
}
- public override bool Add(System.Object o)
- {
- throw new System.NotSupportedException();
- }
-
- public override bool AddAll(System.Collections.ICollection coll)
+ public override bool AddAll(string[] coll)
{
throw new System.NotSupportedException();
}
@@ -432,14 +434,11 @@ namespace Lucene.Net.Analysis
}
/// <summary>Adds all of the elements in the specified collection to this collection </summary>
- public virtual bool AddAll(System.Collections.ICollection items)
+ public virtual bool AddAll(string[] items)
{
bool added = false;
- System.Collections.IEnumerator iter = items.GetEnumerator();
- System.Object item;
- while (iter.MoveNext())
+ foreach(string item in items)
{
- item = iter.Current;
added = Add(item);
}
return added;
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Standard/StandardAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Standard/StandardAnalyzer.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Standard/StandardAnalyzer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/Standard/StandardAnalyzer.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Lucene.Net.Analysis;
using Version = Lucene.Net.Util.Version;
@@ -42,7 +43,7 @@ namespace Lucene.Net.Analysis.Standard
/// </version>
public class StandardAnalyzer : Analyzer
{
- private System.Collections.Hashtable stopSet;
+ private List<string> stopSet;
/// <summary> Specifies whether deprecated acronyms should be replaced with HOST type.
/// This is false by default to support backward compatibility.
@@ -107,7 +108,7 @@ namespace Lucene.Net.Analysis.Standard
/// <summary>An unmodifiable set containing some common English words that are usually not
/// useful for searching.
/// </summary>
- public static readonly System.Collections.Hashtable STOP_WORDS_SET;
+ public static readonly List<string> STOP_WORDS_SET;
/// <summary>Builds an analyzer with the default stop words ({@link
/// #STOP_WORDS_SET}).
@@ -134,7 +135,7 @@ namespace Lucene.Net.Analysis.Standard
/// instead
/// </deprecated>
[Obsolete("Use StandardAnalyzer(Version, Set) instead")]
- public StandardAnalyzer(System.Collections.Hashtable stopWords):this(Version.LUCENE_24, stopWords)
+ public StandardAnalyzer(List<string> stopWords):this(Version.LUCENE_24, stopWords)
{
}
@@ -144,7 +145,7 @@ namespace Lucene.Net.Analysis.Standard
/// </param>
/// <param name="stopWords">stop words
/// </param>
- public StandardAnalyzer(Version matchVersion, System.Collections.Hashtable stopWords)
+ public StandardAnalyzer(Version matchVersion, List<string> stopWords)
{
stopSet = stopWords;
Init(matchVersion);
@@ -279,7 +280,7 @@ namespace Lucene.Net.Analysis.Standard
/// <deprecated> Remove in 3.X and make true the only valid value
/// </deprecated>
[Obsolete("Remove in 3.X and make true the only valid value")]
- public StandardAnalyzer(System.Collections.Hashtable stopwords, bool replaceInvalidAcronym):this(Version.LUCENE_24, stopwords)
+ public StandardAnalyzer(List<string> stopwords, bool replaceInvalidAcronym):this(Version.LUCENE_24, stopwords)
{
this.replaceInvalidAcronym = replaceInvalidAcronym;
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopAnalyzer.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopAnalyzer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopAnalyzer.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Version = Lucene.Net.Util.Version;
@@ -36,7 +37,7 @@ namespace Lucene.Net.Analysis
public sealed class StopAnalyzer:Analyzer
{
- private System.Collections.Hashtable stopWords;
+ private List<string> stopWords;
// @deprecated
[Obsolete]
private bool useDefaultStopPositionIncrement;
@@ -53,7 +54,7 @@ namespace Lucene.Net.Analysis
/// <summary>An unmodifiable set containing some common English words that are not usually useful
/// for searching.
/// </summary>
- public static System.Collections.Hashtable ENGLISH_STOP_WORDS_SET;
+ public static List<string> ENGLISH_STOP_WORDS_SET;
/// <summary>Builds an analyzer which removes words in
/// ENGLISH_STOP_WORDS.
@@ -96,7 +97,7 @@ namespace Lucene.Net.Analysis
/// <deprecated> Use {@link #StopAnalyzer(Version, Set)} instead
/// </deprecated>
[Obsolete("Use StopAnalyzer(Version, Set) instead")]
- public StopAnalyzer(System.Collections.Hashtable stopWords)
+ public StopAnalyzer(List<string> stopWords)
{
this.stopWords = stopWords;
useDefaultStopPositionIncrement = true;
@@ -104,7 +105,7 @@ namespace Lucene.Net.Analysis
}
/// <summary>Builds an analyzer with the stop words from the given set.</summary>
- public StopAnalyzer(Version matchVersion, System.Collections.Hashtable stopWords)
+ public StopAnalyzer(Version matchVersion, List<string> stopWords)
{
this.stopWords = stopWords;
useDefaultStopPositionIncrement = false;
@@ -120,7 +121,7 @@ namespace Lucene.Net.Analysis
/// <deprecated> Use {@link #StopAnalyzer(Version, Set)} instead
/// </deprecated>
[Obsolete("Use StopAnalyzer(Version, Set) instead")]
- public StopAnalyzer(System.Collections.Hashtable stopWords, bool enablePositionIncrements)
+ public StopAnalyzer(List<string> stopWords, bool enablePositionIncrements)
{
this.stopWords = stopWords;
this.enablePositionIncrements = enablePositionIncrements;
@@ -311,7 +312,7 @@ namespace Lucene.Net.Analysis
{
System.String[] stopWords = new System.String[]{"a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"};
CharArraySet stopSet = new CharArraySet(stopWords.Length, false);
- stopSet.AddAll(new System.Collections.ArrayList(stopWords));
+ stopSet.AddAll(stopWords);
ENGLISH_STOP_WORDS_SET = CharArraySet.UnmodifiableSet(stopSet);
}
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopFilter.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/StopFilter.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using PositionIncrementAttribute = Lucene.Net.Analysis.Tokenattributes.PositionIncrementAttribute;
using TermAttribute = Lucene.Net.Analysis.Tokenattributes.TermAttribute;
@@ -114,7 +115,7 @@ namespace Lucene.Net.Analysis
/// <deprecated> Use {@link #StopFilter(boolean, TokenStream, Set, boolean)} instead
/// </deprecated>
[Obsolete("Use StopFilter(bool, TokenStream, Set, bool) instead")]
- public StopFilter(TokenStream input, System.Collections.Hashtable stopWords, bool ignoreCase):this(ENABLE_POSITION_INCREMENTS_DEFAULT, input, stopWords, ignoreCase)
+ public StopFilter(TokenStream input, List<string> stopWords, bool ignoreCase):this(ENABLE_POSITION_INCREMENTS_DEFAULT, input, stopWords, ignoreCase)
{
}
@@ -137,7 +138,7 @@ namespace Lucene.Net.Analysis
/// </param>
/// <param name="ignoreCase">-Ignore case when stopping.
/// </param>
- public StopFilter(bool enablePositionIncrements, TokenStream input, System.Collections.Hashtable stopWords, bool ignoreCase):base(input)
+ public StopFilter(bool enablePositionIncrements, TokenStream input, List<string> stopWords, bool ignoreCase) : base(input)
{
if (stopWords is CharArraySet)
{
@@ -161,7 +162,7 @@ namespace Lucene.Net.Analysis
/// <deprecated> Use {@link #StopFilter(boolean, TokenStream, Set)} instead
/// </deprecated>
[Obsolete("Use StopFilter(bool, TokenStream, Hashtable) instead")]
- public StopFilter(TokenStream in_Renamed, System.Collections.Hashtable stopWords):this(ENABLE_POSITION_INCREMENTS_DEFAULT, in_Renamed, stopWords, false)
+ public StopFilter(TokenStream in_Renamed, List<string> stopWords) : this(ENABLE_POSITION_INCREMENTS_DEFAULT, in_Renamed, stopWords, false)
{
}
@@ -177,7 +178,7 @@ namespace Lucene.Net.Analysis
/// </param>
/// <seealso cref="MakeStopSet(java.lang.String[])">
/// </seealso>
- public StopFilter(bool enablePositionIncrements, TokenStream in_Renamed, System.Collections.Hashtable stopWords):this(enablePositionIncrements, in_Renamed, stopWords, false)
+ public StopFilter(bool enablePositionIncrements, TokenStream in_Renamed, List<string> stopWords) : this(enablePositionIncrements, in_Renamed, stopWords, false)
{
}
@@ -195,7 +196,7 @@ namespace Lucene.Net.Analysis
/// </summary>
/// <seealso cref="MakeStopSet(java.lang.String[], boolean)"> passing false to ignoreCase
/// </seealso>
- public static System.Collections.Hashtable MakeStopSet(System.String[] stopWords)
+ public static List<string> MakeStopSet(System.String[] stopWords)
{
return MakeStopSet(stopWords, false);
}
@@ -208,7 +209,7 @@ namespace Lucene.Net.Analysis
/// </summary>
/// <seealso cref="MakeStopSet(java.lang.String[], boolean)"> passing false to ignoreCase
/// </seealso>
- public static System.Collections.Hashtable MakeStopSet(System.Collections.IList stopWords)
+ public static List<string> MakeStopSet(List<string> stopWords)
{
return MakeStopSet(stopWords, false);
}
@@ -220,10 +221,10 @@ namespace Lucene.Net.Analysis
/// </param>
/// <returns> a Set containing the words
/// </returns>
- public static System.Collections.Hashtable MakeStopSet(System.String[] stopWords, bool ignoreCase)
+ public static List<string> MakeStopSet(System.String[] stopWords, bool ignoreCase)
{
CharArraySet stopSet = new CharArraySet(stopWords.Length, ignoreCase);
- stopSet.AddAll(new System.Collections.ArrayList(stopWords));
+ stopSet.AddAll(stopWords);
return stopSet;
}
@@ -234,10 +235,10 @@ namespace Lucene.Net.Analysis
/// </param>
/// <returns> A Set containing the words
/// </returns>
- public static System.Collections.Hashtable MakeStopSet(System.Collections.IList stopWords, bool ignoreCase)
+ public static List<string> MakeStopSet(List<string> stopWords, bool ignoreCase)
{
CharArraySet stopSet = new CharArraySet(stopWords.Count, ignoreCase);
- stopSet.AddAll(stopWords);
+ stopSet.AddAll(stopWords.ToArray());
return stopSet;
}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/WordlistLoader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/WordlistLoader.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/WordlistLoader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Analysis/WordlistLoader.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Analysis
{
@@ -39,9 +40,9 @@ namespace Lucene.Net.Analysis
/// </param>
/// <returns> A HashSet with the file's words
/// </returns>
- public static System.Collections.Hashtable GetWordSet(System.IO.FileInfo wordfile)
+ public static List<string> GetWordSet(System.IO.FileInfo wordfile)
{
- System.Collections.Hashtable result = new System.Collections.Hashtable();
+ List<string> result = new List<string>();
System.IO.StreamReader reader = null;
try
{
@@ -68,9 +69,9 @@ namespace Lucene.Net.Analysis
/// </param>
/// <returns> A HashSet with the file's words
/// </returns>
- public static System.Collections.Hashtable GetWordSet(System.IO.FileInfo wordfile, System.String comment)
+ public static List<string> GetWordSet(System.IO.FileInfo wordfile, System.String comment)
{
- System.Collections.Hashtable result = new System.Collections.Hashtable();
+ List<string> result = new List<string>();
System.IO.StreamReader reader = null;
try
{
@@ -96,16 +97,16 @@ namespace Lucene.Net.Analysis
/// </param>
/// <returns> A HashSet with the reader's words
/// </returns>
- public static System.Collections.Hashtable GetWordSet(System.IO.TextReader reader)
+ public static List<string> GetWordSet(System.IO.TextReader reader)
{
- System.Collections.Hashtable result = new System.Collections.Hashtable();
+ List<string> result = new List<string>();
System.IO.TextReader br = null;
try
{
System.String word = null;
while ((word = reader.ReadLine()) != null)
{
- Support.CollectionsHelper.Add(result, word.Trim());
+ result.Add(word.Trim());
}
}
finally
@@ -128,9 +129,9 @@ namespace Lucene.Net.Analysis
/// </param>
/// <returns> A HashSet with the reader's words
/// </returns>
- public static System.Collections.Hashtable GetWordSet(System.IO.TextReader reader, System.String comment)
+ public static List<string> GetWordSet(System.IO.TextReader reader, System.String comment)
{
- System.Collections.Hashtable result = new System.Collections.Hashtable();
+ List<string> result = new List<string>();
System.IO.StreamReader br = null;
try
{
@@ -139,7 +140,7 @@ namespace Lucene.Net.Analysis
{
if (word.StartsWith(comment) == false)
{
- Support.CollectionsHelper.Add(result, word.Trim());
+ result.Add(word.Trim());
}
}
}
@@ -161,11 +162,11 @@ namespace Lucene.Net.Analysis
/// <returns> stem dictionary that overrules the stemming algorithm
/// </returns>
/// <throws> IOException </throws>
- public static System.Collections.Hashtable GetStemDict(System.IO.FileInfo wordstemfile)
+ public static Dictionary<string,string> GetStemDict(System.IO.FileInfo wordstemfile)
{
if (wordstemfile == null)
throw new System.NullReferenceException("wordstemfile may not be null");
- System.Collections.Hashtable result = new System.Collections.Hashtable();
+ Dictionary<string, string> result = new Dictionary<string, string>();
System.IO.StreamReader br = null;
System.IO.StreamReader fr = null;
try
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestCharArraySet.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestCharArraySet.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestCharArraySet.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestCharArraySet.cs Sat May 7 18:03:36 2011
@@ -184,7 +184,7 @@ namespace Lucene.Net.Analysis
try
{
- set_Renamed.AddAll(new System.Collections.ArrayList(new System.String[] { NOT_IN_SET }));
+ set_Renamed.AddAll(new System.String[] { NOT_IN_SET });
Assert.Fail("Modified unmodifiable set");
}
catch (System.NotSupportedException e)
@@ -203,7 +203,7 @@ namespace Lucene.Net.Analysis
public virtual void TestUnmodifiableSet()
{
CharArraySet set_Renamed = new CharArraySet(10, true);
- set_Renamed.AddAll(new System.Collections.ArrayList(TEST_STOP_WORDS));
+ set_Renamed.AddAll(TEST_STOP_WORDS);
int size = set_Renamed.Count;
set_Renamed = CharArraySet.UnmodifiableSet(set_Renamed);
Assert.AreEqual(size, set_Renamed.Count, "Set size changed due to UnmodifiableSet call");
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopAnalyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopAnalyzer.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopAnalyzer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopAnalyzer.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -70,10 +71,10 @@ namespace Lucene.Net.Analysis
[Test]
public virtual void TestStopList()
{
- System.Collections.Hashtable stopWordsSet = new System.Collections.Hashtable();
- stopWordsSet.Add("good", "good");
- stopWordsSet.Add("test", "test");
- stopWordsSet.Add("analyzer", "analyzer");
+ List<string> stopWordsSet = new List<string>();
+ stopWordsSet.Add("good");
+ stopWordsSet.Add("test");
+ stopWordsSet.Add("analyzer");
StopAnalyzer newStop = new StopAnalyzer(stopWordsSet);
System.IO.StringReader reader = new System.IO.StringReader("This is a good test of the english stop analyzer");
TokenStream stream = newStop.TokenStream("test", reader);
@@ -96,10 +97,10 @@ namespace Lucene.Net.Analysis
StopFilter.SetEnablePositionIncrementsDefault(true);
try
{
- System.Collections.Hashtable stopWordsSet = new System.Collections.Hashtable();
- stopWordsSet.Add("good", "good");
- stopWordsSet.Add("test", "test");
- stopWordsSet.Add("analyzer", "analyzer");
+ List<string> stopWordsSet = new List<string>();
+ stopWordsSet.Add("good");
+ stopWordsSet.Add("test");
+ stopWordsSet.Add("analyzer");
StopAnalyzer newStop = new StopAnalyzer(stopWordsSet);
System.IO.StringReader reader = new System.IO.StringReader("This is a good test of the english stop analyzer with positions");
int[] expectedIncr = new int[]{1, 1, 1, 3, 1, 1, 1, 2, 1};
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopFilter.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Analysis/TestStopFilter.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -66,7 +67,7 @@ namespace Lucene.Net.Analysis
{
System.IO.StringReader reader = new System.IO.StringReader("Now is The Time");
System.String[] stopWords = new System.String[]{"is", "the", "Time"};
- System.Collections.Hashtable stopSet = StopFilter.MakeStopSet(stopWords);
+ List<string> stopSet = StopFilter.MakeStopSet(stopWords);
TokenStream stream = new StopFilter(false, new WhitespaceTokenizer(reader), stopSet);
TermAttribute termAtt = (TermAttribute) stream.GetAttribute(typeof(TermAttribute));
Assert.IsTrue(stream.IncrementToken());
@@ -93,7 +94,7 @@ namespace Lucene.Net.Analysis
System.String[] stopWords = (System.String[]) a.ToArray();
for (int i = 0; i < a.Count; i++)
Log("Stop: " + stopWords[i]);
- System.Collections.Hashtable stopSet = StopFilter.MakeStopSet(stopWords);
+ List<string> stopSet = StopFilter.MakeStopSet(stopWords);
// with increments
System.IO.StringReader reader = new System.IO.StringReader(sb.ToString());
StopFilter stpf = new StopFilter(false, new WhitespaceTokenizer(reader), stopSet);
@@ -122,8 +123,8 @@ namespace Lucene.Net.Analysis
System.String[] stopWords1 = (System.String[]) a1.ToArray();
for (int i = 0; i < a1.Count; i++)
Log("Stop1: " + stopWords1[i]);
- System.Collections.Hashtable stopSet0 = StopFilter.MakeStopSet(stopWords0);
- System.Collections.Hashtable stopSet1 = StopFilter.MakeStopSet(stopWords1);
+ List<string> stopSet0 = StopFilter.MakeStopSet(stopWords0);
+ List<string> stopSet1 = StopFilter.MakeStopSet(stopWords1);
reader = new System.IO.StringReader(sb.ToString());
StopFilter stpf0 = new StopFilter(false, new WhitespaceTokenizer(reader), stopSet0); // first part of the set
stpf0.SetEnablePositionIncrements(true);
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestWordlistLoader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestWordlistLoader.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestWordlistLoader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestWordlistLoader.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -33,9 +34,9 @@ namespace Lucene.Net.Index
public virtual void TestWordlistLoading()
{
System.String s = "ONE\n two \nthree";
- System.Collections.Hashtable wordSet1 = WordlistLoader.GetWordSet(new System.IO.StringReader(s));
+ List<string> wordSet1 = WordlistLoader.GetWordSet(new System.IO.StringReader(s));
CheckSet(wordSet1);
- System.Collections.Hashtable wordSet2 = WordlistLoader.GetWordSet(new System.IO.StringReader(s));
+ List<string> wordSet2 = WordlistLoader.GetWordSet(new System.IO.StringReader(s));
CheckSet(wordSet2);
}
@@ -43,14 +44,14 @@ namespace Lucene.Net.Index
public virtual void TestComments()
{
System.String s = "ONE\n two \nthree\n#comment";
- System.Collections.Hashtable wordSet1 = WordlistLoader.GetWordSet(new System.IO.StringReader(s), "#");
+ List<string> wordSet1 = WordlistLoader.GetWordSet(new System.IO.StringReader(s), "#");
CheckSet(wordSet1);
Assert.IsFalse(wordSet1.Contains("#comment"));
Assert.IsFalse(wordSet1.Contains("comment"));
}
-
-
- private void CheckSet(System.Collections.Hashtable wordset)
+
+
+ private void CheckSet(List<string> wordset)
{
Assert.AreEqual(3, wordset.Count);
Assert.IsTrue(wordset.Contains("ONE")); // case is not modified
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/QueryParser/TestQueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/QueryParser/TestQueryParser.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/QueryParser/TestQueryParser.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/QueryParser/TestQueryParser.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -882,8 +883,8 @@ namespace Lucene.Net.QueryParsers
[Test]
public virtual void TestBoost()
{
- System.Collections.Hashtable stopWords = new System.Collections.Hashtable(1);
- Support.CollectionsHelper.AddIfNotContains(stopWords, "on");
+ List<string> stopWords = new List<string>(1);
+ stopWords.Add("on");
StandardAnalyzer oneStopAnalyzer = new StandardAnalyzer(stopWords);
QueryParser qp = new QueryParser("field", oneStopAnalyzer);
Query q = qp.Parse("on^1.0");
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/Spans/TestSpans.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/Spans/TestSpans.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/Spans/TestSpans.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/Spans/TestSpans.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -505,7 +506,7 @@ namespace Lucene.Net.Search.Spans
public virtual void TestNPESpanQuery()
{
Directory dir = new MockRAMDirectory();
- IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(new System.Collections.Hashtable(0)), IndexWriter.MaxFieldLength.LIMITED);
+ IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(new List<string>(0)), IndexWriter.MaxFieldLength.LIMITED);
// Add documents
AddDoc(writer, "1", "the big dogs went running to the market");
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/TestMultiPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/TestMultiPhraseQuery.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/TestMultiPhraseQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/TestMultiPhraseQuery.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -177,7 +178,7 @@ namespace Lucene.Net.Search
public virtual void TestPhrasePrefixWithBooleanQuery()
{
RAMDirectory indexStore = new RAMDirectory();
- IndexWriter writer = new IndexWriter(indexStore, new StandardAnalyzer(new System.Collections.Hashtable(0)), true, IndexWriter.MaxFieldLength.LIMITED);
+ IndexWriter writer = new IndexWriter(indexStore, new StandardAnalyzer(new List<string>(0)), true, IndexWriter.MaxFieldLength.LIMITED);
Add("This is a test", "object", writer);
Add("a note", "note", writer);
writer.Close();
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestWindowsMMap.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestWindowsMMap.cs?rev=1100581&r1=1100580&r2=1100581&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestWindowsMMap.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Store/TestWindowsMMap.cs Sat May 7 18:03:36 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -77,7 +78,7 @@ namespace Lucene.Net.Store
// plan to add a set of useful stopwords, consider changing some of the
// interior filters.
- StandardAnalyzer analyzer = new StandardAnalyzer(new System.Collections.Hashtable());
+ StandardAnalyzer analyzer = new StandardAnalyzer(new List<string>());
// TODO: something about lock timeouts and leftover locks.
IndexWriter writer = new IndexWriter(storeDirectory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
IndexSearcher searcher = new IndexSearcher(storePathname);