Class | Ferret::Analysis::PerFieldAnalyzer |
In: |
ext/r_analysis.c
|
Parent: | Ferret::Analysis::Analyzer |
The PerFieldAnalyzer is for use when you want to analyze different fields with different analyzers. With the PerFieldAnalyzer you can specify how you want each field analyzed.
# Create a new PerFieldAnalyzer which uses StandardAnalyzer by default pfa = PerFieldAnalyzer.new(StandardAnalyzer.new()) # Use the WhiteSpaceAnalyzer with no lowercasing on the :title field pfa[:title] = WhiteSpaceAnalyzer.new(false) # Use a custom analyzer on the :created_at field pfa[:created_at] = DateAnalyzer.new
Create a new PerFieldAnalyzer specifying the default analyzer to use on all fields that are set specifically.
default_analyzer: | analyzer to be used on fields that aren‘t otherwise specified |
Set the analyzer to be used on field field_name. Note that field_name should be a symbol.
field_name: | field we wish to set the analyzer for |
analyzer: | analyzer to be used on field_name |
Set the analyzer to be used on field field_name. Note that field_name should be a symbol.
field_name: | field we wish to set the analyzer for |
analyzer: | analyzer to be used on field_name |
Create a new TokenStream to tokenize input. The TokenStream created will also depend on the field_name in the case of the PerFieldAnalyzer.
field_name: | name of the field to be tokenized |
input: | data from the field to be tokenized |