public virtual void TestFilter() { TokenStream stream = new WhitespaceTokenizer(new System.IO.StringReader("short toolong evenmuchlongertext a ab toolong foo")); LengthFilter filter = new LengthFilter(stream, 2, 6); Assert.AreEqual("short", filter.Next().TermText()); Assert.AreEqual("ab", filter.Next().TermText()); Assert.AreEqual("foo", filter.Next().TermText()); Assert.IsNull(filter.Next()); }
public virtual void TestFilter() { TokenStream stream = new WhitespaceTokenizer(new System.IO.StringReader("short toolong evenmuchlongertext a ab toolong foo")); LengthFilter filter = new LengthFilter(stream, 2, 6); TermAttribute termAtt = (TermAttribute)filter.GetAttribute(typeof(TermAttribute)); Assert.IsTrue(filter.IncrementToken()); Assert.AreEqual("short", termAtt.Term()); Assert.IsTrue(filter.IncrementToken()); Assert.AreEqual("ab", termAtt.Term()); Assert.IsTrue(filter.IncrementToken()); Assert.AreEqual("foo", termAtt.Term()); Assert.IsFalse(filter.IncrementToken()); }
public virtual void TestFilter() { TokenStream stream = new WhitespaceTokenizer(new System.IO.StringReader("short toolong evenmuchlongertext a ab toolong foo")); LengthFilter filter = new LengthFilter(stream, 2, 6); ITermAttribute termAtt = filter.GetAttribute<ITermAttribute>(); Assert.IsTrue(filter.IncrementToken()); Assert.AreEqual("short", termAtt.Term); Assert.IsTrue(filter.IncrementToken()); Assert.AreEqual("ab", termAtt.Term); Assert.IsTrue(filter.IncrementToken()); Assert.AreEqual("foo", termAtt.Term); Assert.IsFalse(filter.IncrementToken()); }