On 9/29/06, Albert <[EMAIL PROTECTED]> wrote:
> David Balmain wrote:
> > On 9/6/06, Alastair Moore <[EMAIL PROTECTED]> wrote:
> >> Alastair
> > The default analyzer doesn't perform any stemming. You need to create
> > your own analyzer with a stemmer. Something like this;
> >
> >     require 'rubygems'
> >     require 'ferret'
> >
> >     module Ferret::Analysis
> >       class MyAnalyzer
> >         def token_stream(field, text)
> >           StemFilter.new(StandardTokenizer.new(text))
> >         end
> >       end
> >     end
> >
> >     index = Ferret::I.new(:analyzer => Ferret::Analysis::MyAnalyzer.new)
> >
> >     index << "test"
> >     index << "tests debate debater debating the for,"
> >     puts index.search("test").total_hits
> >
> > Hope that helps,
> > Dave
>
> Hi there,
>
> Thanks for this useful piece of information!  What I'm wondering is how
> do stemming on queries as well.  My first try was:
>
> query = Ferret::QueryParser.new(:analyzer =>
> Ferret::Analysis::StemmingAnalyzer.new).parse(query_string)
>
> index.search_each(query) { |doc, score| ... }
>
> But this does not work the way I would expect it to work, i.e., it seems
> to deliver empty results independent of the input.
>
> Does anybody have an idea what I'm doing wrong?
>
> Cheers,
>
> 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
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to