On 9/9/06, David Balmain <[EMAIL PROTECTED]> wrote:
> On 9/10/06, Kent Sibilev <[EMAIL PROTECTED]> wrote:
> > Is there a way to add per-field analyzer? I can't seem to find a way to do
> > that.
> >
> > Thanks
> >
> > --
> > Kent
>
> Hi Kent,
>
> I'm not sure if you mean add *to* a PerFieldAnalyzer or add a
> PerFieldAnalyzer to and Index. Here is how you do both;
>
> include Ferret::Analysis
> pfa = PerFieldAnalyzer.new(StandardAnalyzer.new())
> pfa['white'] = WhiteSpaceAnalyzer.new(false)
> pfa['white_l'] = WhiteSpaceAnalyzer.new(true)
> pfa['letter'] = LetterAnalyzer.new(false)
> pfa.add_field('letter', LetterAnalyzer.new(true))
> pfa.add_field('letter_u', LetterAnalyzer.new(false))
>
> index = Ferret::Index::Index.new(:analyzer => pfa)
>
> I hope that's what you were asking.
>
Perfect. That's exactly what I've been looking for. Now I see it in
test cases, but rdoc lacks any the information about analyzers.
--
Kent
---
http://www.datanoise.com
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk