本文介绍了searchkick 不返回带有空格的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我有这个搜索方法:
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
这不适用于空格......例如bassjam
与 bass jam
不匹配,如果我搜索 bass jam
,结果想要返回正常!
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?
山姆
推荐答案
从选项中删除match: :word_start
这篇关于searchkick 不返回带有空格的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!