C# Class org.apache.lucene.analysis.miscellaneous.LimitTokenPositionFilter

This TokenFilter limits its emitted tokens to those with positions that are not greater than the configured limit.

By default, this filter ignores any tokens in the wrapped {@code TokenStream} once the limit has been exceeded, which can result in {@code reset()} being called prior to {@code incrementToken()} returning {@code false}. For most {@code TokenStream} implementations this should be acceptable, and faster then consuming the full stream. If you are wrapping a {@code TokenStream} which requires that the full stream of tokens be exhausted in order to function properly, use the #LimitTokenPositionFilter(TokenStream,int,boolean) consumeAllTokens option.

Inheritance: TokenFilter
Show file Open project: paulirwin/lucene.net Class Usage Examples

Public Methods

Method Description
LimitTokenPositionFilter ( TokenStream @in, int maxTokenPosition )

Build a filter that only accepts tokens up to and including the given maximum position. This filter will not consume any tokens with position greater than the maxTokenPosition limit.

LimitTokenPositionFilter ( TokenStream @in, int maxTokenPosition, bool consumeAllTokens )

Build a filter that limits the maximum position of tokens to emit.

incrementToken ( ) : bool
reset ( ) : void

Method Details

LimitTokenPositionFilter() public method

Build a filter that only accepts tokens up to and including the given maximum position. This filter will not consume any tokens with position greater than the maxTokenPosition limit.
public LimitTokenPositionFilter ( TokenStream @in, int maxTokenPosition )
@in TokenStream
maxTokenPosition int max position of tokens to produce (1st token always has position 1) ///

LimitTokenPositionFilter() public method

Build a filter that limits the maximum position of tokens to emit.
public LimitTokenPositionFilter ( TokenStream @in, int maxTokenPosition, bool consumeAllTokens )
@in TokenStream
maxTokenPosition int max position of tokens to produce (1st token always has position 1)
consumeAllTokens bool whether all tokens from the wrapped input stream must be consumed /// even if maxTokenPosition is exceeded.

incrementToken() public method

public incrementToken ( ) : bool
return bool

reset() public method

public reset ( ) : void
return void