On 9/6/06, Alastair Moore <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Quick question (possibly!) - I've got a few records indexed and doing a
> search for 'test' reports in no hits even though I know the word 'tests'
> exists in the indexed field. Doing a search for 'tests' produces a
> result. I would have thought that 'test' would match 'tests' but no such
> luck!
>
> Thanks,
>
> 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
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to