Hi all, using ferret 0.10.13 and aaf trunk, i cannot get more_like_this to work. I read other posts on this forum related to that, but that did not solve it. I have a model Question with a field question_text. I do: ----------------------------------------------->> q = Question.find(:first)>> q.more_like_thisNoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.each from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:110:in `retrieve_terms'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:65:in `more_like_this'' from /usr/lib/ruby/1.8/monitor.rb:229:in `synchronize'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:61:in `more_like_this'' from (irb):8>> q.more_like_thisNoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.each from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:110:in `retrieve_terms'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:65:in `more_like_this'' from /usr/lib/ruby/1.8/monitor.rb:229:in `synchronize'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:61:in `more_like_this'' from (irb):9>> q.more_like_this(:fields => [:question_text])NoMethodError: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.each from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:110:in `retrieve_terms'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:65:in `more_like_this'' from /usr/lib/ruby/1.8/monitor.rb:229:in `synchronize'' from ./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/more_like_this.rb:61:in `more_like_this'' from (irb):8 ----------------------------------------------- Am I doing something wrong or is this a bug? -- Posted via http://www.ruby-forum.com/.
On Fri, Dec 01, 2006 at 10:46:23AM +0100, Corn? Verbruggen wrote:> Hi all, > > using ferret 0.10.13 and aaf trunk, i cannot get more_like_this to work. > I read other posts on this forum related to that, but that did not solve > it. > > I have a model Question with a field question_text. I do: > > ----------------------------------------------- > >> q = Question.find(:first) > > >> q.more_like_thisyou''ll have to give an array of field names to use for the similarity search: q.more_like_this :field_names => [ :question_text ] 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
Jens Kraemer wrote:> On Fri, Dec 01, 2006 at 10:46:23AM +0100, Corn? Verbruggen wrote: >> >> >> q.more_like_this > > you''ll have to give an array of field names to use for the similarity > search: > > q.more_like_this :field_names => [ :question_text ] > > Jens >Thanks! -- Posted via http://www.ruby-forum.com/.