Displaying 1 result from an estimated 1 matches for "generate_query".
2008 May 12
1
Using StemFilter with PhraseQuery
...succinct solution for now.
I use a StemFilter in my analyzer as follows:
def token_stream(field, str)
...
ts = LowerCaseFilter.new(ts) if @lower
ts = StopFilter.new(ts, @stop_words)
ts = StemFilter.new(ts)
...
end
My use of PhraseQuery is as follows:
def generate_query(phrase)
phrase = phrase.downcase
phrase_parts = phrase.split('' '')
query = Ferret::Search::PhraseQuery.new(:content, 2)
phrase_parts.each do |part|
# puts "part: \"" + part + "\""
query.add_term(part, 1)
end
query...