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

This analyzer is used to facilitate scenarios where different fields require different analysis techniques. Use the Map argument in #PerFieldAnalyzerWrapper(Analyzer, java.util.Map) to add non-default analyzers for fields.

Example usage:

 {@code Map analyzerPerField = new HashMap<>(); analyzerPerField.put("firstname", new KeywordAnalyzer()); analyzerPerField.put("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: AnalyzerWrapper
Exibir arquivo Open project: paulirwin/lucene.net Class Usage Examples

Public Methods

Method Description
PerFieldAnalyzerWrapper ( Analyzer defaultAnalyzer ) : System.Collections.Generic

Constructs with default analyzer.

PerFieldAnalyzerWrapper ( Analyzer defaultAnalyzer, Analyzer>.IDictionary fieldAnalyzers ) : System.Collections.Generic

Constructs with default analyzer and a map of analyzers to use for specific fields.

ToString ( ) : string

Protected Methods

Method Description
getWrappedAnalyzer ( string fieldName ) : Analyzer

Method Details

PerFieldAnalyzerWrapper() public method

Constructs with default analyzer.
public PerFieldAnalyzerWrapper ( Analyzer defaultAnalyzer ) : System.Collections.Generic
defaultAnalyzer Analyzer Any fields not specifically /// defined to use a different analyzer will use the one provided here.
return System.Collections.Generic

PerFieldAnalyzerWrapper() public method

Constructs with default analyzer and a map of analyzers to use for specific fields.
public PerFieldAnalyzerWrapper ( Analyzer defaultAnalyzer, Analyzer>.IDictionary fieldAnalyzers ) : System.Collections.Generic
defaultAnalyzer Analyzer Any fields not specifically /// defined to use a different analyzer will use the one provided here.
fieldAnalyzers Analyzer>.IDictionary a Map (String field name to the Analyzer) to be /// used for those fields
return System.Collections.Generic

ToString() public method

public ToString ( ) : string
return string

getWrappedAnalyzer() protected method

protected getWrappedAnalyzer ( string fieldName ) : Analyzer
fieldName string
return Analyzer