Ruby Forum Ruby on Rails > Finding "similar" results of find_all

Posted by Paweł K (Guest)
on 09.05.2008 09:27
(Received via mailing list)
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 :)
Posted by Craig White (Guest)
on 09.05.2008 15:23
(Received via mailing list)
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
Posted by Frederick Cheung (Guest)
on 09.05.2008 15:28
(Received via mailing list)
On May 9, 2:22 pm, Craig White <craigwh...@azapple.com> 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