I’d like to get the following behavior:
-
Stemming. The search is on a database of summaries of California
legal
cases. Things like a search for “thermal image” needs to hit “thermal
imaging.” -
Stop words. Searches for “failing to instruct the jury” should come
up
with hits on a search for “fail to instruct.” -
Case-insensitive.
What I tried was:
class StemmedAnalyzer < Ferret::Analysis::Analyzer
def token_stream(field, reader)
return
Ferret::Analysis::PorterStemFilter.new(Ferret::Analysis::LowerCaseTokenizer.
new(reader))
end
end
class Summary < ActiveRecord::Base
acts_as_ferret(:analyzer => StemmedAnalyzer.new)
But this doesn’t appear to give me either stemming or stopwords. It
does
give me basic searching (searches for exact keywords without stopwords
work,
searches with stopwords return no results).
I’ve looked through the archives, and I’m still confused. Suggestions?
- James M.