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
Example #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testFilterWithPosIncr() throws Exception
        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 });
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testFilterNoPosIncr() throws Exception
        public virtual void testFilterNoPosIncr()
        {
            TokenStream  stream = new MockTokenizer(new StringReader("short toolong evenmuchlongertext a ab toolong foo"), MockTokenizer.WHITESPACE, false);
            LengthFilter filter = new LengthFilter(Version.LUCENE_43, false, stream, 2, 6);

            assertTokenStreamContents(filter, new string[] { "short", "ab", "foo" }, new int[] { 1, 1, 1 });
        }
	  public override LengthFilter create(TokenStream input)
	  {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("deprecation") final LengthFilter filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input,min,max);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
		  LengthFilter filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input,min,max);
		return filter;
	  }
Example #4
0
        public override LengthFilter create(TokenStream input)
        {
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("deprecation") final LengthFilter filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input,min,max);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            LengthFilter filter = new LengthFilter(luceneMatchVersion, enablePositionIncrements, input, min, max);

            return(filter);
        }
Example #5
0
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public void testFilterWithPosIncr() throws Exception
 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});
 }
Example #6
0
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public void testFilterNoPosIncr() throws Exception
 public virtual void testFilterNoPosIncr()
 {
     TokenStream stream = new MockTokenizer(new StringReader("short toolong evenmuchlongertext a ab toolong foo"), MockTokenizer.WHITESPACE, false);
     LengthFilter filter = new LengthFilter(Version.LUCENE_43, false, stream, 2, 6);
     assertTokenStreamContents(filter, new string[]{"short", "ab", "foo"}, new int[]{1, 1, 1});
 }