Newbie question

Hi,
I’m new to using ferret (and fairly new to ruby/rails) and I’m having a
problem I can’t fathom. Sorry for the long post …

I have a test which passes

require ‘rubygems’
require ‘ferret’
include Ferret
require ‘test/unit’
class CompanyTest < Test::Unit::TestCase

def test_index
puts ‘running test’
@index = Index::Index.new(:path => ‘…/tmp/search-index’)
@index << {:title => “prospecting”, :content => “blah blah blah”}
@index << {:title => “prospecting”, :content => “yada yada yada”}

@index.search_each(‘content:“blah”’) do |id, score|
#just assert true if we didn’t get an error … ferret
#seems to be working
assert true

end

end
end

which I think means that ferret is properly installed

When I search in my app I get this error

undefined method `exists?’ for {:term_vector=>:no, :store=>:no,
:boost=>1.0, :index=>:yes}:Hash
RAILS_ROOT: /Users/chrisc/Documents/checkouts/PROS/config/…

Application Trace | Framework Trace | Full Trace
/opt/local/lib/ruby/site_ruby/1.8/ferret/index/field_infos.rb:20:in
initialize' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:166:inrebuild_index’
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:230:in
create_index_instance' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:223:inferret_index’
#{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:389:in
find_id_by_contents' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/class_methods.rb:253:infind_by_contents’
#{RAILS_ROOT}/app/controllers/companies_controller.rb:517:in
createConditionsFromParameters' #{RAILS_ROOT}/app/controllers/companies_controller.rb:694:ingenerate_list_from_filter’
#{RAILS_ROOT}/app/controllers/companies_controller.rb:290:in
`list_profile_information’
/opt/local/bin/mongrel_rails:18

which looks to me as if acts_as_ferret is not finding the ferret index

In my model I have

require ‘rubygems’
require ‘ferret’
include Ferret
acts_as_ferret :fields => [ ‘name’, ‘comments’]

and in the controller
companies=Company.find_by_contents(params[:company_search_term])

I don’t see that aaf is building the index, which I think is where the
app is blowing up. My reading of the docs is that it should do. Did I
do something dumb, or is there a known issue with these versions that I
missed?

Many thanks for any help … this is driving me crazy …
Rails 1.1.6
Ruby 1.8.4
acts_as_ferret from svn
Ferret 0.10.9
on mac OS X

On Tue, Oct 03, 2006 at 09:22:36AM +0200, Chris C. wrote:

Hi,
I’m new to using ferret (and fairly new to ruby/rails) and I’m having a
problem I can’t fathom. Sorry for the long post …
[…]
`rebuild_index’
[…]
Many thanks for any help … this is driving me crazy …
Rails 1.1.6
Ruby 1.8.4
acts_as_ferret from svn
Ferret 0.10.9
on mac OS X

strange, on my system line 20 in field_infos.rb is inside a comment, and
no use of exists? is made inside the file. Are you sure that
field_infos.rb belongs to Ferrewt 0.10.9 ?

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

Jens
Thanks very much - this helped me find the problem which was an old
version of ferret in the path and a failure on my part to check that the
same version of ruby was being callled in the console and by mongrel.

chris

Jens K. wrote:

On Tue, Oct 03, 2006 at 09:22:36AM +0200, Chris C. wrote:

Hi,
I’m new to using ferret (and fairly new to ruby/rails) and I’m having a
problem I can’t fathom. Sorry for the long post …
[…]
`rebuild_index’
[…]
Many thanks for any help … this is driving me crazy …
Rails 1.1.6
Ruby 1.8.4
acts_as_ferret from svn
Ferret 0.10.9
on mac OS X

strange, on my system line 20 in field_infos.rb is inside a comment, and
no use of exists? is made inside the file. Are you sure that
field_infos.rb belongs to Ferrewt 0.10.9 ?

Jens


webit! Gesellschaft f�r neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Kr�mer [email protected]
Schnorrstra�e 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs