Forum: Ferret undefined method `ferret_rank='

Posted by Philip Ingram (Guest)
on 2009-06-04 00:38
(Received via mailing list)
i am getting the following error message using the AAF gem version
0.4.4 in my rails app.

undefined method `ferret_rank=' for #<Page:0x246060c>

i"m using multi search but i have the same code working on another
app, using the plugin.  To me this method looks like it's missing from
the gem version, but is that possible?

I have an index compiled, but this error appears whenever i search for
something in the index. when i search for terms not in the index, it
works as expected,.. nothing is returned.

More trace stack:

/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active_record/
attribute_methods.rb:255:in `method_missing'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:
474:in `retrieve_records'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:
473:in `each'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:
473:in `retrieve_records'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:
452:in `each'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:
452:in `retrieve_records'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/
ferret_find_methods.rb:43:in `ar_find'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/
ferret_find_methods.rb:12:in `find_records'
/Library/Ruby/Gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:
343:in `find'
Thoughts???
Posted by Philip Ingram (Guest)
on 2009-06-04 00:58
(Received via mailing list)
i am not using multi search, i meant to write i am using a shared
index, but it only had ONE model in it for now.  although that still
doesn't seem to make a difference.

sorry for the confusion.
Posted by Carl Burton (spasm)
on 2009-11-30 04:35

Did you manage to solve this issue. I have exactly the same error using 
the shared index in config/aaf.rb

In the console I rebuilt the indexes for the relevant 3 models I am 
using.
I do an example search in the console:

results = ActsAsFerret.find("pete*", 'shared')

I get results back perfectly.

When I do it in the application I get

undefined method `ferret_rank=' for <2nd model in my list>
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/attribute_methods.rb:255:in 
`method_missing'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:474:in 
`retrieve_records'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:473:in 
`each'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:473:in 
`retrieve_records'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:452:in 
`each'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:452:in 
`retrieve_records'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/ferret_find_methods.rb:43:in 
`ar_find'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/ferret_find_methods.rb:12:in 
`find_records'
/usr/local/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.4/lib/acts_as_ferret.rb:343:in 
`find'

Can anyone help I am banging my head against a wall :-)

Thanks in advance.
Posted by Carl Burton (spasm)
on 2009-11-30 06:47
http://github.com/jkraemer/acts_as_ferret/blob/mas...

472      # set scores and rank
473      tmp_result.each do |record|
474        record.ferret_rank, record.ferret_score = 
id_array[record.id.to_s]
475      end

is where it breaks.
Posted by Carl Burton (spasm)
on 2009-12-03 01:58
I spoke to Jens who was on vacation - thanks a lot mate, really 
appreciate your help. It appears that this happens when the model is not 
extended properly.

Solutions:
 -- Use the plugin rather than the gem. This fixed it for more straight 
away.
 -- require config/aaf.rb in your environment.rb

Hope this helps some one.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.