Ruby 我如何使用sequel ORM和3个参数进行全文搜索?
这是给杰里米的!这可能是不可能的,因为我想将3个参数传递给全文搜索,但它设计为只接受一个参数。代码如下:Ruby 我如何使用sequel ORM和3个参数进行全文搜索?,ruby,postgresql,sequel,Ruby,Postgresql,Sequel,这是给杰里米的!这可能是不可能的,因为我想将3个参数传递给全文搜索,但它设计为只接受一个参数。代码如下: experience_search_term = params[:search_term] candidates.full_text_search(:experience, experience_search_term).to_a.to_json 很好,但是 candidates.where(:city => params['city'], :industry => para
experience_search_term = params[:search_term]
candidates.full_text_search(:experience, experience_search_term).to_a.to_json
很好,但是
candidates.where(:city => params['city'], :industry => params['industry']).full_text_search(:experience => params['search_term']).to_a.to_json
该黑客不会也不会:
dataset = candidates.where(:city => params['city'], :industry => params['industry'])
dataset.full_text_search(:experience => params['search_term']).to_a.to_json
有办法做到这一点吗?感谢您的帮助。我想您应该使用两个参数,而不是一个散列,就像您的第一个示例:
dataset = candidates.where(:city => params['city'], :industry => params['industry'])
dataset.full_text_search(:experience, params['search_term']).to_a.to_json
啊,谢谢你,杰里米。那看起来不一样。我会试一试,明天再来。太棒了,杰里米,非常感谢。上次我们讨论了FultTythOrthQualy时,你说你会考虑用一个以上的词来做这件事,例如一个短语。对此还有什么想法吗?PostgreSQL已经支持了这一点。您只需在搜索词中引用短语:
dataset.full_text_search(:experience,“'multiple words here'”)。to_a.to_json
谢谢!必须弄清楚如何传递用单引号括起来的参数。