On 07.12.2006, at 06:27, Raymond O'connor wrote:

> Well, you bring up another question I had.  I was using a similar line
> as yours above to call the stem analyzer and I always would get a  
> parse
> error.  I even get a parse error when I paste your line in.  I'm  
> pretty
> new to ruby, and I'm sure its something obvious but I can't get rid of
> the parse error without removing the hash ticks such as
> acts_as_ferret :fields => ["id", "name", "body"], :analyzer =>
> MyFunkyStemAnalyzer
> When I do that, AAF never seems to call my analyzer.  So I ended up
> editing the AAF code and setting the analyzer option inside there  
> and it
> worked except I get the whole problem I stated above.

This is the method signature as of the latest AAF rdoc:

acts_as_ferret(options={}, ferret_options={})

It expects two hashes, defaulting to empty hashes if no arguments are  
supplied. In Ruby you can omit the parentheses for a method call and  
the curly braces for a hash argument if it is the last argument.

A method with the signature

my_method(options = {})

may be used in the following ways:

my_method
my_method({:key => "value"})
my_method(:key => "value")
my_method {:key => "value"}
my_method :key => "value"

So the following call is supposed to work

acts_as_ferret {:fields => ["id", "name", "body"]}, {:analyzer =>  
MyFunkyStemAnalyzer}

You could try parentheses

acts_as_ferret({:fields => ["id", "name", "body"]}, {:analyzer =>  
MyFunkyStemAnalyzer})

which should work in any case since it is the most explicit form.

If you still get a parse error, you might want to post your actual  
code and the error message you get.

HTH
Andy


_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to