我正在关注这个Railscasts 插曲。
如果我搜索“Kerber”,它确实会返回正确的文章。但如果我搜索“Ke”,它不会返回同一篇文章。
有办法解决这个问题吗?
class Item < ActiveRecord::Base
include PgSearch
pg_search_scope :search, against: [:description, :about, :link, :twitterhandle, :builtby],
using: {tsearch: {dictionary: "english"}}
def self.text_search(query)
if query.present?
search(query)
else
scoped
end
end