On Mon, Mar 30, 2015 at 3:55 PM, Fredrik Boström <[email protected]> wrote:
> Maybe I expressed myself a bit unclearly. I'm not trying to reinvent SQL or > create a new database implementation, that's insane! Okay. Maybe I jumped the gun a bit too; I've seen lots of zealous people, at the stage where they "know enough to be dangerous", head down such a path. :-) > What I'm after is a way to > do more complex filtering of the result set using query parameters than what > ActiveRecord now supports. Perhaps you could take query params that included embedded ANDs and ORs and some parentheses, and pass them off to some gem that can handle that on each field. So, you would wind up with a URL like: GET /api/users?name=Doris OR Fred&location=Stockholm&hobbies=horseback OR swimming Then, inside your controller (or better yet, User.search method or UserSearch.call or whatever), have it take whatever searchable params were given and hand them off to, say, Solr or ThinkingSphinx or whatever. Or-ing THOSE together, so as to look for anyone who's in Stockholm OR is interested in horseback or swimming, is another story. I think you can do that with Solr (been a while since I've used it) but of course the handling and syntax would be different. In summary, check out the assorted search gems, especially full-text search, see what they can do for you, and base your syntax on what can be easily broken up into the kinds of pieces your preferred search gem expects. -Dave -- Dave Aronson, consulting software developer of Codosaur.us, PullRequestRoulette.com, Blog.Codosaur.us, and Dare2XL.com. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAHxKQihC7Trqau8wi%2B%3D%2Bj3dOQE%2BXvDgyKhgMWYOKS7VNmZ5W_Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

