public void TestTokenStream() { QueryAutoStopWordAnalyzer a = new QueryAutoStopWordAnalyzer(Version.LUCENE_CURRENT, new WhitespaceAnalyzer()); a.AddStopWords(reader, 10); TokenStream ts = a.TokenStream("repetitiveField", new StringReader("this boring")); ITermAttribute termAtt = ts.GetAttribute<ITermAttribute>(); Assert.True(ts.IncrementToken()); Assert.AreEqual("this", termAtt.Term); Assert.False(ts.IncrementToken()); }
public void TestWrappingNonReusableAnalyzer() { QueryAutoStopWordAnalyzer a = new QueryAutoStopWordAnalyzer(Version.LUCENE_CURRENT, new NonreusableAnalyzer()); a.AddStopWords(reader, 10); int numHits = Search(a, "repetitiveField:boring"); Assert.True(numHits == 0); numHits = Search(a, "repetitiveField:vaguelyboring"); Assert.True(numHits == 0); }