searchkick not returnign results with whitespaces

2019-03-04 13:19发布

问题:

so i have this searckick method:

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

This isn't working with whitespaces.... e.g. bassjam isn't matching bass jam, if i search bass jam the results wanted return fine!

any ideas why this isn't working as expected?

Sam

回答1:

delete match: :word_start from the options