Class Ferret::Analysis::PerFieldAnalyzer
In: ext/r_analysis.c
Parent: Ferret::Analysis::Analyzer

Summary

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.

Example

  # 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

Methods

[]=   add_field   new  

Public Class methods

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

Public Instance methods

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

[Validate]