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:in 
`rebuild_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:in 
`ferret_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:in 
`find_by_contents'
#{RAILS_ROOT}/app/controllers/companies_controller.rb:517:in 
`createConditionsFromParameters'
#{RAILS_ROOT}/app/controllers/companies_controller.rb:694:in 
`generate_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

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to