所以我有这个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
这不适用于空格....例如bassjam
与bass jam
任何想法为什么?
萨姆