Search code examples
rubypostgresqlsequel

how can I do a full_text_search, using sequel ORM, with 3 parameters?


This is for Jeremy! It may not be possible as I would like to pass 3 parameters to a full text search but it is designed to take only one. Here is the code:

experience_search_term = params[:search_term] 
candidates.full_text_search(:experience, experience_search_term).to_a.to_json

works fine, but

candidates.where(:city => params['city'], :industry => params['industry']).full_text_search(:experience  => params['search_term']).to_a.to_json

does not and nor does this hack:

dataset = candidates.where(:city => params['city'], :industry => params['industry'])
dataset.full_text_search(:experience  => params['search_term']).to_a.to_json

Is there a way to do this? All help gratefully received.


Solution

  • I think you want to use 2 arguments instead of a single hash, just as in your first example:

    dataset = candidates.where(:city => params['city'], :industry => params['industry'])
    dataset.full_text_search(:experience, params['search_term']).to_a.to_json