This analyzer is used to facilitate scenarios where different
fields require different analysis techniques. Use
PerFieldAnalyzerWrapper.addAnalyzer to add a non-default analyzer on a field name basis.
Example usage:
PerFieldAnalyzerWrapper aWrapper =
new PerFieldAnalyzerWrapper(new StandardAnalyzer());
aWrapper.addAnalyzer("firstname", new KeywordAnalyzer());
aWrapper.addAnalyzer("lastname", new KeywordAnalyzer());
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.
|