Sunsopt Solr Group不使用全文搜索

时间:2014-10-15 10:21:21

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

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 }}

相同

1 个答案:

答案 0 :(得分:0)

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

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