trying to do this advance seach using the pg_seach gem pg_search<https://github.com/Casecommons/pg_search> There is my advance_search pg_search_scope :advance_search, using: { tsearch: { dictionary: "spanish"} }, associated_against: {summary: [:summary_description, :specialties], experience: [:description, :job_title], study: [:study_title], course: [:title], language: [:language]} this is the method def self.advsearch(summary_description, specialties, place, study, course, language) end As you can imagine the parameters could be present all of them, none of them or some of them so incide my method I would like to do somehting like :summary => summary_description.present? or something like that, also is the parameter is not present the pg_search doesn''t need the joing. I don''t find anything similar in the help. So I need the help of all of you Thanks 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/p__VjnZwZjcJ. For more options, visit https://groups.google.com/groups/opt_out.
Dave Aronson
2013-Jan-16 21:10 UTC
Re: Pg_Search gem for advance search is parameter is present
On Tue, Jan 15, 2013 at 5:20 PM, Jean <josorioe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> def self.advsearch(summary_description, specialties, place, study, course, > language) > > end > > As you can imagine the parameters could be present all of them, none of them > or some of themI would advise you make each of them a single-item scope, and then chain them together in this one. That will be the most modular and flexible. On each one, you can test for whether the desired item is present or not, before invoking the pg_search scope. See http://www.slideshare.net/dare2xl/full-text-search-on-heroku-for-free for more information -Dave (who wrote that slide deck) -- Dave Aronson, the T. Rex of Codosaurus LLC, secret-cleared freelance software developer taking contracts in or near NoVa or remote. See information at http://www.Codosaur.us/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.