【问题标题】:Sunspot and Solr: Google-like "site:" in searchSunspot 和 Solr:搜索中类似于 Google 的“站点:”
【发布时间】:2013-03-23 16:09:44
【问题描述】:

我对 Sunspot 和 Solr 还很陌生。

我想在搜索中实现类似于 Google site: 短语的东西,这样当我搜索时

某事

我得到了与“某事”相关的所有记录。但是,如果他们搜索

某网站:example.com

它只显示site 属性为example.com 的结果。

目前我有:

searchable do
    text :full_text
    text :title, :boost => 5
    text :excerpt
end

我需要索引site 属性吗?我将如何实现上述想法?

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 solr sunspot


    【解决方案1】:

    没有。只要确保你在控制器中 gsub 你的 params[:query] 。提取 site: 旁边的值并添加一个 where close 以匹配该站点。你会留下something

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多