Joerg Diekmann
2006-Apr-13 15:57 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
Hi, I''m running the edge Typo and the latest acts_as_ferret plugin and ferret gems (as of 11 April). In my Content model I put acts_as_ferret :fields => [:title, :body] In the console, I call Content.rebuild_index to index all of my existing content. All the directories get created etc, but I get the following error back: Loading development environment.>> Content.rebuild_indexNameError: undefined method `title'' for class `Comment'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:104:in `method'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:104:in `title_to_ferret'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:103:in `title_to_ferret'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:439:in `send'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:439:in `to_doc'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:438:in `each'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:438:in `to_doc'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:217:in `rebuild_index'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:217:in `each'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a cts_as_ferret.rb:217:in `rebuild_index'' from (irb):1>>Has anybody got this to work before? Thanks Joerg -- Posted via http://www.ruby-forum.com/.
Kasper Weibel
2006-Apr-13 16:31 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
I''m not exactly sure why the error is about an undefined method for the class Comment, when you run rebuild_index on Content. 1) Does Comment have the fields ''title'' and ''body'' defined somewhere? 2) Didn''t you mean Comment.rebuild_index? Joerg Diekmann wrote:> In my Content model I put acts_as_ferret :fields => [:title, :body] > Loading development environment. >>> Content.rebuild_index > NameError: undefined method `title'' for class `Comment'' > from > ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a > cts_as_ferret.rb:104:in `method''-- Posted via http://www.ruby-forum.com/.
Joerg Diekmann
2006-Apr-13 18:13 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
Sorry - I wasn''t clear enough. Comment is defined as: class Comment < Content and class Content < ActiveRecord::Base The contents table has fields like title, body, extended etc ... so the Comment model will have them too then. The error isn''t particular to the :title field either ... if I were to have :extended as part of the fields list, it''ll through the same error but wrt extended. Kasper Weibel wrote:> I''m not exactly sure why the error is about an undefined method for the > class Comment, when you run rebuild_index on Content. > > 1) Does Comment have the fields ''title'' and ''body'' defined somewhere? > 2) Didn''t you mean Comment.rebuild_index? > > Joerg Diekmann wrote: >> In my Content model I put acts_as_ferret :fields => [:title, :body] >> Loading development environment. >>>> Content.rebuild_index >> NameError: undefined method `title'' for class `Comment'' >> from >> ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a >> cts_as_ferret.rb:104:in `method''-- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-Apr-17 15:52 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
Hi, I could reproduce the error, but I can''t explain why it happens ;-) I just committed a fix that rescues from the failure and indexes an empty string for the field in question. It seems the errors are raised when aaf tries to index a field that isn''t used by the particular model class, i.e. :title in a Comment object. Could you please try if the change fixes this for you, too ? Greetings, Jens On Thu, Apr 13, 2006 at 08:13:03PM +0200, Joerg Diekmann wrote:> Sorry - I wasn''t clear enough. Comment is defined as: > > class Comment < Content > > and > > class Content < ActiveRecord::Base > > The contents table has fields like title, body, extended etc ... so the > Comment model will have them too then. The error isn''t particular to the > :title field either ... if I were to have :extended as part of the > fields list, it''ll through the same error but wrt extended. > > > > Kasper Weibel wrote: > > I''m not exactly sure why the error is about an undefined method for the > > class Comment, when you run rebuild_index on Content. > > > > 1) Does Comment have the fields ''title'' and ''body'' defined somewhere? > > 2) Didn''t you mean Comment.rebuild_index? > > > > Joerg Diekmann wrote: > >> In my Content model I put acts_as_ferret :fields => [:title, :body] > >> Loading development environment. > >>>> Content.rebuild_index > >> NameError: undefined method `title'' for class `Comment'' > >> from > >> ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/a > >> cts_as_ferret.rb:104:in `method'' > > > -- > 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
Joerg Diekmann
2006-Apr-17 16:18 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
I can test it ... do I just get the latest acts_as_ferret.rb file? http://www.jkraemer.net/files/acts_as_ferret.rb Jens Kraemer wrote:> Hi, > > I could reproduce the error, but I can''t explain why it happens ;-) > I just committed a fix that rescues from the failure and indexes an > empty string for the field in question.-- Posted via http://www.ruby-forum.com/.
Kasper Weibel
2006-Apr-17 16:39 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
That''s an old location. Try here instead (or use SVN) http://projects.jkraemer.net/acts_as_ferret/browser/trunk/plugin/acts_as_ferret/lib/acts_as_ferret.rb?format=raw Joerg Diekmann wrote:> I can test it ... do I just get the latest acts_as_ferret.rb file? > http://www.jkraemer.net/files/acts_as_ferret.rb > > > Jens Kraemer wrote: >> Hi, >> >> I could reproduce the error, but I can''t explain why it happens ;-) >> I just committed a fix that rescues from the failure and indexes an >> empty string for the field in question.-- Posted via http://www.ruby-forum.com/.
Joerg Diekmann
2006-Apr-17 16:57 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
Ok got it thanks. Tried it out. Error is gone. Return value from rebuild_index is false. Is that right? Kasper Weibel wrote:> That''s an old location. Try here instead (or use SVN) > http://projects.jkraemer.net/acts_as_ferret/browser/trunk/plugin/acts_as_ferret/lib/acts_as_ferret.rb?format=raw > >-- Posted via http://www.ruby-forum.com/.
Kasper Weibel
2006-Apr-17 17:08 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
According to the API false is the correct value http://ferret.davebalmain.com/api/classes/Ferret/Index/Index.html#M000041 Joerg Diekmann wrote:> Ok got it thanks. Tried it out. Error is gone. Return value from > rebuild_index is false. Is that right? >-- Posted via http://www.ruby-forum.com/.
Joerg Diekmann
2006-Apr-17 17:51 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
K great. Well - I tested it by doing searches, and my content was correctly indexed. Thanks a lot for your help! Joerg Kasper Weibel wrote:> According to the API false is the correct value > http://ferret.davebalmain.com/api/classes/Ferret/Index/Index.html#M000041 > > > Joerg Diekmann wrote: >> Ok got it thanks. Tried it out. Error is gone. Return value from >> rebuild_index is false. Is that right? >>-- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-Apr-17 20:59 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
On Mon, Apr 17, 2006 at 07:51:07PM +0200, Joerg Diekmann wrote:> K great. Well - I tested it by doing searches, and my content was > correctly indexed. > > Thanks a lot for your help!glad to help :-) 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
Ray Baxter
2006-Apr-23 00:59 UTC
[Ferret-talk] Typo and acts_as_ferret rebuild_index errror
Jens Kraemer wrote:> I could reproduce the error, but I can''t explain why it happens ;-) > I just committed a fix that rescues from the failure and indexes an > empty string for the field in question. > > It seems the errors are raised when aaf tries to index a > field that isn''t used by the particular model class, i.e. :title in a > Comment object.I was seeing a similar error on cases where there would be a single row that had NULL for the value of an indexed field. Rows before that row would index and then the exception would be encountered and indexing would stop. This fix also works for me. Thanks, Ray -- Posted via http://www.ruby-forum.com/.