Hi Dave,

Thanks for following up!  The StemmingAnalyzer is actually just the 
MyAnalyzer from the example above:

module Ferret::Analysis
  class StemmingAnalyzer
    def token_stream(field, text)
      StemFilter.new(StandardTokenizer.new(text))
    end
  end
end

I've been trying to find the error but no success.  The searching is 
done this way:

    i = Ferret::Index::Index.new(:path => index)
    qp = Ferret::QueryParser.new(:analyzer => 
Ferret::Analysis::StemmingAnalyzer.new)
    query = qp.parse(query_string)
    i.search_each(query) { |doc, score| ... }

What I don't get is that search_each(query) never returns a result 
whereas when I use the original query string as in

    i = Ferret::Index::Index.new(:path => index)
#    qp = Ferret::QueryParser.new(:analyzer => 
Ferret::Analysis::StemmingAnalyzer.new)
#    query = qp.parse(query_string)
    i.search_each(query_string) { |doc, score| ... }
                  ------------

things work as expected (modulo the stemmming, of course).  So, it may 
be that I fundamentally misunderstand something or make a stupid mistake 
...

Cheers,

Albert

David Balmain wrote:
> On 9/29/06, Albert <[EMAIL PROTECTED]> wrote:
>> >       class MyAnalyzer
>> >     puts index.search("test").total_hits
>> Ferret::Analysis::StemmingAnalyzer.new).parse(query_string)
>> Albert
> Hi Albert,
> 
> Could you show us your implementation of StemmingAnalyzer as well.
> Also, you need to be sure to use the same analyzer for both indexing
> and analysis, although I think you already new this.
> 
> Cheers,
> Dave


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to