Per field analyzer

Is there a way to add per-field analyzer? I can’t seem to find a way to
do that.

Thanks


Kent

On 9/10/06, Kent S. [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.

Dave

On 9/9/06, David B. [email protected] wrote:

I’m not sure if you mean add to a PerFieldAnalyzer or add a
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

On 9/10/06, Kent S. [email protected] wrote:

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.

Whoops. I wrote my own frt_define_class_under to replace
rb_define_class_under and rdoc was no longer picking up the
documentation. It’s fixed now and will be out in the next release. In
the meantime you can see the full documentation here;

http://ferret.davebalmain.com/api/

Cheers,
Dave