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.
on 2013-01-15 23:21
on 2013-01-16 22:12
On Tue, Jan 15, 2013 at 5:20 PM, Jean <josorioe@gmail.com> 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 them I 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... 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/.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.