# Finding "similar" results of find\_all

**URL:** <https://www.ruby-forum.com/t/finding-similar-results-of-find-all/137138>\
**Category:** Rails\
**Created:** [May 9, 2008, 9:27am UTC](https://www.ruby-forum.com/t/finding-similar-results-of-find-all/137138 "2008-05-09T09:27:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaweSSSSSK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@PaweSSSSSK](https://www.ruby-forum.com/u/PaweSSSSSK)\
**Post date:** [May 9, 2008, 9:27am UTC](https://www.ruby-forum.com/t/finding-similar-results-of-find-all/137138/1 "2008-05-09T09:27:43Z")

</div>

Hi 🙂

I need to make something like a search engine, this means I post a  
query like “cat” and I’d like rails to find all rows with specified  
field containing this word, like “black bat”, “catwalk” and so

Is there any other option than :condition =\> [“content LIKE %?%”,  
search\_mask] ???

Thank you in advance 🙂

---

<div class="post-metadata">

**Author:** ![PaweSSSSSK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@PaweSSSSSK](https://www.ruby-forum.com/u/PaweSSSSSK)\
**Post date:** [May 9, 2008, 3:23pm UTC](https://www.ruby-forum.com/t/finding-similar-results-of-find-all/137138/2 "2008-05-09T15:23:03Z")

</div>

On Fri, 2008-05-09 at 00:27 -0700, PaweÅ‚ K wrote:

> Hi 🙂
> 
> I need to make something like a search engine, this means I post a  
> query like “cat” and I’d like rails to find all rows with specified  
> field containing this word, like “black bat”, “catwalk” and so
> 
> Is there any other option than :condition =\> [“content LIKE %?%”,  
> search\_mask] ???
> 
> Thank you in advance 🙂

* * *

sure - you can find\_by\_sql and thus any SQL select statement you can  
come up with can be used.

Craig

---

<div class="post-metadata">

**Author:** ![PaweSSSSSK](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/838e76/32.png) [@PaweSSSSSK](https://www.ruby-forum.com/u/PaweSSSSSK)\
**Post date:** [May 9, 2008, 3:28pm UTC](https://www.ruby-forum.com/t/finding-similar-results-of-find-all/137138/3 "2008-05-09T15:28:57Z")

</div>

On May 9, 2:22 pm, Craig W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Fri, 2008-05-09 at 00:27 -0700, Pawe³ K wrote:

> * * *
> 
> sure - you can find\_by\_sql and thus any SQL select statement you can  
> come up with can be used.

More generally a full text search engine (mysql’s builtin one, sphinx,  
ferret etc…) will be more powerful than mashing things around with  
Like and %. (some will do stemming and things like that as well)

Fred
