On 9/6/06, Kent Sibilev <[EMAIL PROTECTED]> wrote:
> Lucene's standard analyzer splits words separater with underscores.
> Ferret doesn't do this. For example, if I create an index with only
> document 'test_case' and search for 'case' it doesn't find anything.
> Lucene on the other hand finds it. The same story goes for words
> separated by colons.
>
> Which analyzer should I use to emulate Lucene's StandardAnalyzer
> behavior?
>
> Thanks.
> Kent

Hi Kent,

No analyzer currently emulates Lucene's StandardAnalyzer exactly.
You'd have to port it to Ruby which shouldn't be too hard if you know
how to use racc. But is sounds to me like you don't need anything so
complex. If you are indexing code you might want to try using the
AsciiLetterAnalyzer. Or you could use the RegExpAnalyzer and describe
your tokens with a Ruby RegExp. Something like this;

    include Ferret
    include Ferret::Analysis
    index = I.new(:analyzer => RegExpAnalyzer.new(/[A-Za-z0-9]/))

    # or if you want case sensitive searches;
    index = I.new(:analyzer => RegExpAnalyzer.new(/[A-Za-z0-9]/, false))

Hope that helps,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to