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 :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-May-09 13:28 UTC
Re: ****[Rails] Finding "similar" results of find_all
On May 9, 2:22 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---