【问题标题】:Sunsopt Solr Group not working with fulltext searchSunsopt Solr Group 不使用全文搜索
【发布时间】:2014-10-15 10:21:20
【问题描述】:

Sunsopt Solr 全文搜索和组不起作用

a = User.search { fulltext("") { highlight :document_text, :fragment_size => 300, :group => document_id }}


--- SOLR Request (9.7ms)  [ path=select parameters={fq: ["type:User"], start: 0, rows: 30, q: "*:*"} ]

 => <Sunspot::Search:{:fq=>["type:User"], :start=>0, :rows=>30, :q=>"*:*"}> 

 2.1.2 :081 > a.group(:document_id)
 => nil 

我也试过这样

 User.search { fulltext("terms", :group => "doc_name") { highlight :document_text, :fragment_size => 300 }}

得到相同的

【问题讨论】:

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


    【解决方案1】:

    你的user.rb 也应该有 solr 的可搜索块。

    ##for sunspot search..something like this...
        searchable do
          text :username, :boost => 3
          text :first_name,:last_name
        end
    

    【讨论】:

    • yes searchable do integer :id time :created_at time :updated_at text :document_text, stored: true integer :page_no integer :document_id string :doc_name end
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-29
    相关资源
    最近更新 更多