When calling a Result.find_by_content on my model, I get the following error: Mysql::Error: Table ''db.results'' doesn''t exist: SHOW FIELDS FROM results Yes, I remembered to put acts_as_ferret. Any ideas? Trace: /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log'' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:in `execute'' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:293:in `columns'' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:in `columns'' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:213:in `column_for'' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:135:in `calculate'' /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:64:in `count'' #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:249:in `rebuild_index'' -- Posted via http://www.ruby-forum.com/.
On Wed, Aug 02, 2006 at 11:14:41AM +0200, Winton wrote:> When calling a Result.find_by_content on my model, I get the following > error: > > Mysql::Error: Table ''db.results'' doesn''t exist: SHOW FIELDS FROM results > > Yes, I remembered to put acts_as_ferret. Any ideas?in fact, acts_as_ferret depends on your model being an ActiveRecord::Base child class represented by a database table. For example, it may need to look up what fields your model has. Besides that, in your case the index doesn''t seem to exist, so aaf tries to build one from the Result records in the database - which fails. Jens> > > Trace: > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in > `log'' > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:in > `execute'' > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:293:in > `columns'' > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:in > `columns'' > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:213:in > `column_for'' > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:135:in > `calculate'' > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:64:in > `count'' > #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:249:in > `rebuild_index'' > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk-- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Hi Winton, that''s right. find_by_content finds a ferret document. From that document the mysql-id gets extracted and then ActiveRecord gets the model from the db. Using ferret fulltext-searches are a magnitude faster than searching on an innodb with LIKE if there are many records on your db and you''ll get the ferret query language for your convenience. If you don''t want to rely on the db at all you need to work with the ferret documents directly. That''s possible as well. Cheers, Jan On 8/2/06, Winton <wintonius at gmail.com> wrote:> > When calling a Result.find_by_content on my model, I get the following > error: > > Mysql::Error: Table ''db.results'' doesn''t exist: SHOW FIELDS FROM results > > Yes, I remembered to put acts_as_ferret. Any ideas? > > > > Trace: > > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord- > 1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in > `log'' > > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord- > 1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:in > `execute'' > > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord- > 1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:293:in > `columns'' > > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord- > 1.14.2/lib/active_record/base.rb:696:in > `columns'' > > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord- > 1.14.2/lib/active_record/calculations.rb:213:in > `column_for'' > > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord- > 1.14.2/lib/active_record/calculations.rb:135:in > `calculate'' > > /Applications/Locomotive2/Bundles/rails112.locobundle/powerpc/lib/ruby/gems/1.8/gems/activerecord- > 1.14.2/lib/active_record/calculations.rb:64:in > `count'' > #{RAILS_ROOT}/vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:249:in > `rebuild_index'' > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20060802/54fa91cb/attachment-0001.html
Ah yes, I failed to read that it updates ActiveRecord also. How do I turn ActiveRecord off? -- Posted via http://www.ruby-forum.com/.
Hi! On Thu, Aug 03, 2006 at 01:54:57AM +0200, Winton wrote:> Ah yes, I failed to read that it updates ActiveRecord also. > > How do I turn ActiveRecord off?if you don''t want to use activerecord, acts_as_ferret won''t be of much use to you. aaf is all about synchronizing some AR model with a ferret index. That is, it''s tied to database create/update operations and will update the ferret index according to the changes made to the database. If your model isn''t backed by a database, you should go and use Ferret directly - just as described at http://ferret.davebalmain.com/api/files/TUTORIAL.html Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66