我当前的范围pg_search
范围如下
pg_search_scope :search_by_title, against: :original_title,
associated_against: { movie_translations: [:title] },
ignoring: :accents, using: { tsearch: { any_word: true, prefix: true } }
目前,只有当start_word与我的查询匹配时,我才能找到电影
Movie.create(original_title: "Bohemian Rapsody")
Movie.search_by_title("bohe")
=> [Movie id 1, original_title: "Bohemian Rapsody"]
Movie.search_by_title("Rap")
=> [Movie id 1, original_title: "Bohemian Rapsody"]
即使单词不是以我的查询开头,但我现在想返回电影
Movie.search_by_title("hemian")
=> []