# More\_like\_this not working?

**URL:** <https://www.ruby-forum.com/t/more-like-this-not-working/77890>\
**Category:** Ferret\
**Created:** [December 1, 2006, 10:46am UTC](https://www.ruby-forum.com/t/more-like-this-not-working/77890 "2006-12-01T10:46:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![corne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@corne](https://www.ruby-forum.com/u/corne)\
**Post date:** [December 1, 2006, 10:46am UTC](https://www.ruby-forum.com/t/more-like-this-not-working/77890/1 "2006-12-01T10:46:23Z")

</div>

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\_this  
> > 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
> 
> > q.more\_like\_this  
> > 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):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?

---

<div class="post-metadata">

**Author:** ![corne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@corne](https://www.ruby-forum.com/u/corne)\
**Post date:** [December 1, 2006, 11:33am UTC](https://www.ruby-forum.com/t/more-like-this-not-working/77890/2 "2006-12-01T11:33:21Z")

</div>

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

–  
webit! Gesellschaft für neue Medien mbH [www.webit.de](http://www.webit.de)  
Dipl.-Wirtschaftsingenieur Jens Krämer removed\_email\_address@domain.invalid  
Schnorrstraße 76 Tel +49 351 46766 0  
D-01069 Dresden Fax +49 351 46766 66

---

<div class="post-metadata">

**Author:** ![corne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/f04885/32.png) [@corne](https://www.ruby-forum.com/u/corne)\
**Post date:** [December 1, 2006, 11:52am UTC](https://www.ruby-forum.com/t/more-like-this-not-working/77890/3 "2006-12-01T11:52:16Z")

</div>

Jens K. 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!
