Class PerFieldAnalyzerWrapper
This analyzer is used to facilitate scenarios where different fields Require different analysis techniques. Use the Map argument in PerFieldAnalyzerWrapper(Analyzer, IDictionary<String, Analyzer>) to add non-default analyzers for fields.
Example usage:
IDictionary<string, Analyzer> analyzerPerField = new Dictionary<string, Analyzer>();
analyzerPerField["firstname"] = new KeywordAnalyzer();
analyzerPerField["lastname"] = new KeywordAnalyzer();
PerFieldAnalyzerWrapper aWrapper =
  new PerFieldAnalyzerWrapper(new StandardAnalyzer(version), analyzerPerField);In this example, StandardAnalyzer will be used for all fields except "firstname" and "lastname", for which KeywordAnalyzer will be used.
A PerFieldAnalyzerWrapper can be used like any other analyzer, for both indexing and query parsing.
Inheritance
Implements
Inherited Members
Namespace: Lucene.Net.Analysis.Miscellaneous
Assembly: Lucene.Net.Analysis.Common.dll
Syntax
public sealed class PerFieldAnalyzerWrapper : AnalyzerWrapper, IDisposableConstructors
| Improve this Doc View SourcePerFieldAnalyzerWrapper(Analyzer)
Constructs with default analyzer.
Declaration
public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer)Parameters
| Type | Name | Description | 
|---|---|---|
| Lucene.Net.Analysis.Analyzer | defaultAnalyzer | Any fields not specifically defined to use a different analyzer will use the one provided here. | 
PerFieldAnalyzerWrapper(Analyzer, IDictionary<String, Analyzer>)
Constructs with default analyzer and a map of analyzers to use for specific fields.
The type of System.Collections.Generic.IDictionary<TKey, TValue> supplied will determine the type of behavior.
| System.Collections.Generic.Dictionary`2 | General use. nullkeys are not supported. | 
| System.Collections.Generic.SortedDictionary`2 | Use when sorted keys are required. nullkeys are not supported. | 
| J2N.Collections.Generic.Dictionary`2 | Similar behavior as System.Collections.Generic.Dictionary`2. nullkeys are supported. | 
| J2N.Collections.Generic.SortedDictionary`2 | Use when sorted keys are required. nullkeys are supported. | 
| J2N.Collections.Generic.LinkedDictionary`2 | Use when insertion order must be preserved (System.Collections.Generic.Dictionary`2 preserves insertion
            order only until items are removed). nullkeys are supported. | 
Declaration
public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer, IDictionary<string, Analyzer> fieldAnalyzers)Parameters
| Type | Name | Description | 
|---|---|---|
| Lucene.Net.Analysis.Analyzer | defaultAnalyzer | Any fields not specifically defined to use a different analyzer will use the one provided here. | 
| System.Collections.Generic.IDictionary<System.String, Lucene.Net.Analysis.Analyzer> | fieldAnalyzers | A System.Collections.Generic.IDictionary<TKey, TValue> (String field name to the Analyzer) to be used for those fields. | 
Methods
| Improve this Doc View SourceGetWrappedAnalyzer(String)
Declaration
protected override Analyzer GetWrappedAnalyzer(string fieldName)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | fieldName | 
Returns
| Type | Description | 
|---|---|
| Lucene.Net.Analysis.Analyzer | 
Overrides
| Improve this Doc View SourceToString()
Declaration
public override string ToString()Returns
| Type | Description | 
|---|---|
| System.String |