如何使用通配符搜索太阳黑子solr?使用*不工作,我想返回所有的结果为教育。
教育是一个可以存在“全部”、“高”、“低”的集合,所以现在我的想法是,如果它的“全部”,就从搜索块中删除它。
with(:orientation, params[:orientation])
if params[:orientation].present? unless params[:orientation] == "all"一定是更好的方法?
搜索块:
search = Sunspot.search Session do
if params[:education].present?
if params[:education] == "all"
# Use a wildcard here
#with(:education, *)
end
end
end发布于 2013-10-18 06:46:52
最好的方法实际上是删除查询,正如您所说的。它更清洁,而且更快,因为发动机有一个较少的条件运行。所以:
with(:orientation, params[:orientation])
if params[:orientation].present? unless params[:orientation] == "all"确实是最好的解决办法。
发布于 2013-10-18 08:28:23
解决办法:
我终于发现了这个问题,我在我的开发数据库中遇到了一些问题,其中配置文件不匹配。+在match表中缺少一些profile_id,修复这些后,重新索引变得很好。
https://stackoverflow.com/questions/19387578
复制相似问题