Finding "similar" results of find_all

Hi :slight_smile:

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 :slight_smile:

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

Hi :slight_smile:

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 :slight_smile:


sure - you can find_by_sql and thus any SQL select statement you can
come up with can be used.

Craig

On May 9, 2:22 pm, Craig W. [email protected] 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs