Removes words that are too long or too short from the stream.

Note: Length is calculated as the number of UTF-16 code units.

Inheritance: Lucene.Net.Analysis.Util.FilteringTokenFilter
Beispiel #1
0
        public virtual void TestFilterWithPosIncr()
        {
            TokenStream  stream = new MockTokenizer(new StringReader("short toolong evenmuchlongertext a ab toolong foo"), MockTokenizer.WHITESPACE, false);
            LengthFilter filter = new LengthFilter(TEST_VERSION_CURRENT, stream, 2, 6);

            AssertTokenStreamContents(filter, new string[] { "short", "ab", "foo" }, new int[] { 1, 4, 2 });
        }
        public virtual void TestFilterNoPosIncr()
        {
            TokenStream  stream = new MockTokenizer(new StringReader("short toolong evenmuchlongertext a ab toolong foo"), MockTokenizer.WHITESPACE, false);
            LengthFilter filter = new LengthFilter(LuceneVersion.LUCENE_43, false, stream, 2, 6);

            AssertTokenStreamContents(filter, new string[] { "short", "ab", "foo" }, new int[] { 1, 1, 1 });
        }
Beispiel #3
0
        public override TokenStream Create(TokenStream input)
        {
#pragma warning disable 612, 618
            var filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input, min, max);
#pragma warning restore 612, 618
            return(filter);
        }
        public override TokenStream Create(TokenStream input)
        {
#pragma warning disable 612, 618
            var filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input, min, max);
#pragma warning restore 612, 618
            return filter;
        }
        public virtual void TestFilterNoPosIncr()
        {
            TokenStream stream = new MockTokenizer(new StringReader("short toolong evenmuchlongertext a ab toolong foo"), MockTokenizer.WHITESPACE, false);
#pragma warning disable 612, 618
            LengthFilter filter = new LengthFilter(LuceneVersion.LUCENE_43, false, stream, 2, 6);
#pragma warning restore 612, 618
            AssertTokenStreamContents(filter, new string[] { "short", "ab", "foo" }, new int[] { 1, 1, 1 });
        }
        public override TokenStream Create(TokenStream input)
        {
            var filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input, min, max);

            return(filter);
        }
 public override TokenStream Create(TokenStream input)
 {
     var filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input, min, max);
     return filter;
 }
 public virtual void TestFilterWithPosIncr()
 {
     TokenStream stream = new MockTokenizer(new StringReader("short toolong evenmuchlongertext a ab toolong foo"), MockTokenizer.WHITESPACE, false);
     LengthFilter filter = new LengthFilter(TEST_VERSION_CURRENT, stream, 2, 6);
     AssertTokenStreamContents(filter, new string[] { "short", "ab", "foo" }, new int[] { 1, 4, 2 });
 }