Class LimitTokenCountAnalyzer
This Lucene.Net.Analysis.Analyzer limits the number of tokens while indexing. It is a replacement for the maximum field length setting inside Lucene.Net.Index.IndexWriter.
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Miscellaneous
Assembly: Lucene.Net.Analysis.Common.dll
Syntax
public sealed class LimitTokenCountAnalyzer : AnalyzerWrapper, IDisposable
Constructors
LimitTokenCountAnalyzer(Analyzer, int)
Build an analyzer that limits the maximum number of tokens per field. This analyzer will not consume any tokens beyond the maxTokenCount limit
Declaration
public LimitTokenCountAnalyzer(Analyzer @delegate, int maxTokenCount)
Parameters
Type | Name | Description |
---|---|---|
Analyzer | delegate | |
int | maxTokenCount |
See Also
LimitTokenCountAnalyzer(Analyzer, int, bool)
Build an analyzer that limits the maximum number of tokens per field.
Declaration
public LimitTokenCountAnalyzer(Analyzer @delegate, int maxTokenCount, bool consumeAllTokens)
Parameters
Type | Name | Description |
---|---|---|
Analyzer | delegate | the analyzer to wrap |
int | maxTokenCount | max number of tokens to produce |
bool | consumeAllTokens | whether all tokens from the delegate should be consumed even if maxTokenCount is reached. |
See Also
Methods
GetWrappedAnalyzer(string)
Retrieves the wrapped Lucene.Net.Analysis.Analyzer appropriate for analyzing the field with the given name
Declaration
protected override Analyzer GetWrappedAnalyzer(string fieldName)
Parameters
Type | Name | Description |
---|---|---|
string | fieldName | Name of the field which is to be analyzed |
Returns
Type | Description |
---|---|
Analyzer | Lucene.Net.Analysis.Analyzer for the field with the given name. Assumed to be non-null |
Overrides
See Also
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
See Also
WrapComponents(string, TokenStreamComponents)
Wraps / alters the given Lucene.Net.Analysis.TokenStreamComponents, taken from the wrapped Lucene.Net.Analysis.Analyzer, to form new components. It is through this method that new Lucene.Net.Analysis.TokenFilters can be added by Lucene.Net.Analysis.AnalyzerWrappers. By default, the given components are returned.
Declaration
protected override TokenStreamComponents WrapComponents(string fieldName, TokenStreamComponents components)
Parameters
Type | Name | Description |
---|---|---|
string | fieldName | Name of the field which is to be analyzed |
TokenStreamComponents | components | Lucene.Net.Analysis.TokenStreamComponents taken from the wrapped Lucene.Net.Analysis.Analyzer |
Returns
Type | Description |
---|---|
TokenStreamComponents | Wrapped / altered Lucene.Net.Analysis.TokenStreamComponents. |