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());
		}
示例#2
0
        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());
        }
示例#3
0
 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());
 }