searchkick没有返回带有空格的结果

时间:2017-10-11 11:18:59

标签: ruby-on-rails searchkick

所以我有这个searckick方法:

search_options = {
  misspellings: { edit_distance: 2 },
  fields: [:eventname, :date, :city],
  order: { _score: :desc, date: :asc, eventname: :asc, city: :asc },
  match: :word_start,
  suggest: true,
  page: params[:page],
  per_page: 20
}
if params[:date_from].present?
  datefrom = params[:date_from].to_datetime.strftime('%Y-%m-%d')
  dateto = params[:date_to].to_datetime.strftime('%Y-%m-%d')
  search_options[:where] =  { date: {gte: datefrom, lte: dateto} }
end

这不适用于空格....例如bassjambass jam不匹配,如果我搜索bass jam,则希望结果返回正常!

为什么这不能按预期工作的任何想法?

萨姆

1 个答案:

答案 0 :(得分:0)

从选项中删除match: :word_start