0

How would one search in Sunspot solr with a wildcard? Use * does not work, I want to return all the results for education.

Education is a collection that can exists of "All", "High", "Low", so now my idea is to remove it from the search block if its "All"

with(:orientation, params[:orientation])  
if params[:orientation].present? unless params[:orientation] == "all"

Must be a better way?

Search block:

search = Sunspot.search Session do

      if params[:education].present?
        if params[:education] == "all"
          # Use a wildcard here
          #with(:education, *)
        end
      end
end
4

2 回答 2

1

最好的方法实际上是按照您的说法删除查询。它更清洁、更快,因为发动机的运行条件少了一个。所以:

with(:orientation, params[:orientation])  
if params[:orientation].present? unless params[:orientation] == "all"

确实是最好的解决方案。

于 2013-10-18T06:46:52.303 回答
0

解决方案:

我终于找到了问题,我的开发数据库中有一些问题,其中 Profile 没有匹配。+ 匹配表中缺少一些 profile_id,修复这些后,重新索引就正常了。

于 2013-10-18T08:28:23.463 回答