Class AnalyzerWrapper
Extension to Analyzer suitable for Analyzers which wrap other Analyzers.
GetWrappedAnalyzer(String) allows the Analyzer to wrap multiple Analyzers which are selected on a per field basis.
WrapComponents(String, TokenStreamComponents) allows the TokenStreamComponents of the wrapped Analyzer to then be wrapped (such as adding a new TokenFilter to form new TokenStreamComponents).
Inherited Members
Namespace: Lucene.Net.Analysis
Assembly: Lucene.Net.dll
Syntax
public abstract class AnalyzerWrapper : Analyzer
Constructors
| Improve this Doc View SourceAnalyzerWrapper()
Creates a new AnalyzerWrapper. Since the ReuseStrategy of the wrapped Analyzers are unknown, PER_FIELD_REUSE_STRATEGY is assumed.
Declaration
protected AnalyzerWrapper()
AnalyzerWrapper(ReuseStrategy)
Creates a new AnalyzerWrapper with the given reuse strategy.
If you want to wrap a single delegate Analyzer you can probably
reuse its strategy when instantiating this subclass:
base(innerAnalyzer.Strategy)
.
If you choose different analyzers per field, use PER_FIELD_REUSE_STRATEGY.
Declaration
protected AnalyzerWrapper(ReuseStrategy reuseStrategy)
Parameters
Type | Name | Description |
---|---|---|
ReuseStrategy | reuseStrategy |
See Also
Methods
| Improve this Doc View SourceCreateComponents(String, TextReader)
Declaration
protected override sealed TokenStreamComponents CreateComponents(string fieldName, TextReader aReader)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | |
TextReader | aReader |
Returns
Type | Description |
---|---|
TokenStreamComponents |
Overrides
| Improve this Doc View SourceGetOffsetGap(String)
Declaration
public override int GetOffsetGap(string fieldName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
| Improve this Doc View SourceGetPositionIncrementGap(String)
Declaration
public override int GetPositionIncrementGap(string fieldName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
| Improve this Doc View SourceGetWrappedAnalyzer(String)
Retrieves the wrapped Analyzer appropriate for analyzing the field with the given name
Declaration
protected abstract Analyzer GetWrappedAnalyzer(string fieldName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | Name of the field which is to be analyzed |
Returns
Type | Description |
---|---|
Analyzer | Analyzer for the field with the given name. Assumed to be non-null |
InitReader(String, TextReader)
Declaration
protected override TextReader InitReader(string fieldName, TextReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | |
TextReader | reader |
Returns
Type | Description |
---|---|
TextReader |
Overrides
| Improve this Doc View SourceWrapComponents(String, TokenStreamComponents)
Wraps / alters the given TokenStreamComponents, taken from the wrapped Analyzer, to form new components. It is through this method that new TokenFilters can be added by AnalyzerWrappers. By default, the given components are returned.
Declaration
protected virtual TokenStreamComponents WrapComponents(string fieldName, TokenStreamComponents components)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | Name of the field which is to be analyzed |
TokenStreamComponents | components | TokenStreamComponents taken from the wrapped Analyzer |
Returns
Type | Description |
---|---|
TokenStreamComponents | Wrapped / altered TokenStreamComponents. |
WrapReader(String, TextReader)
Wraps / alters the given
Declaration
protected virtual TextReader WrapReader(string fieldName, TextReader reader)
Parameters
Type | Name | Description |
---|---|---|
System.String | fieldName | name of the field which is to be analyzed |
TextReader | reader | the reader to wrap |
Returns
Type | Description |
---|---|
TextReader | the wrapped reader |