【问题标题】:sunspot solr: search for "Everything" / wildcardsunspot solr:搜索“一切”/通配符
【发布时间】:2013-10-15 17:40:57
【问题描述】:

如何使用通配符在 Sunspot solr 中进行搜索? 使用 * 不起作用,我要返回所有结果用于教育。

Education 是一个可以存在“All”、“High”、“Low”的集合,所以现在我的想法是如果它是“All”,则将其从搜索块中删除

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

【问题讨论】:

    标签: ruby-on-rails search solr sunspot


    【解决方案1】:

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

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

    确实是最好的解决方案。

    【讨论】:

      【解决方案2】:

      解决方案:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-08-29
        • 1970-01-01
        • 1970-01-01
        • 2011-03-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多