pg_search_scope按一个表中的两个不同列

时间:2019-01-30 10:54:50

标签: ruby-on-rails ruby pg-search

为什么无法通过当前表的第二列进行搜索?有谁知道该如何解决?

model.rb

  pg_search_scope :search,
              :against => [:name, :phone_number],
              using: { tsearch: { prefix: true, any_word: true } },
              associated_against: {
                :client => [:name, :phone_number]
              }

console_log

2.5.3 :060 > Client.search("Davis, Lorentzz")

=> #<ActiveRecord::Relation [#<Client id: 100, company_id: 8, name: "Davis, Lorentzz", email: "gdrgrd@fgrd.com", variety: "person", active: nil, created_at: "2019-01-29 11:50:17", updated_at: "2019-01-29 11:50:20", phone_number: "1456455453", organisation: "", office_note: "", special_note: "Special Davis">]> 

2.5.3 :061 > Client.search("1456455453")

=> #<ActiveRecord::Relation []> 

0 个答案:

没有答案