To edit pages or tickets please login with username/password: aaf/aaf

Changeset 265

Show
Ignore:
Timestamp:
11/14/07 09:25:14 (1 year ago)
Author:
jk
Message:

add testcase for custom analyzer

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/demo/app/models/comment.rb

    r264 r265  
     1 
     2class PlainAsciiAnalyzer < ::Ferret::Analysis::Analyzer 
     3  include ::Ferret::Analysis 
     4  def token_stream(field, str) 
     5        StopFilter.new( 
     6          StandardTokenizer.new(str) , 
     7          ["fax", "gsm"] 
     8        ) 
     9    # raise #<<<----- is never executed when uncommented !! 
     10  end 
     11end 
     12 
     13 
    114class Comment < ActiveRecord::Base 
    215  belongs_to :parent, :class_name => 'Content', :foreign_key => :parent_id 
     
    2134                    :added   => { :index => :untokenized, :store => :yes, :ignore => true } 
    2235                  }, :ferret => { :analyzer => Ferret::Analysis::StandardAnalyzer.new(['fax', 'gsm', 'the', 'or']) } ) 
     36                  #}, :ferret => { :analyzer => PlainAsciiAnalyzer.new(['fax', 'gsm', 'the', 'or']) } ) 
    2337 
    2438  # only index the named fields: 

To edit pages or tickets please login with username/password: aaf/aaf