我正在使用SearchKick
來搜索數據。我正在執行分頁。我怎樣才能得到總的結果數在這種情況下:SearchKick獲得總結果數
我searchkick結果:
#<Searchkick::Results:0x007faeeef8ed88
@facets=nil,
@max_score=0.0,
@options=
{:load=>true,
:payload=>
{:query=>{:match_all=>{}},
:size=>20,
:from=>0,
:sort=>{"created_at"=>:desc},
:filter=>{:and=>[{:term=>{"sub_category_id"=>2}}]},
:fields=>[]},
:size=>20,
:from=>0,
:term=>"*"},
@response=
{"took"=>4,
"timed_out"=>false,
"_shards"=>{"total"=>5, "successful"=>5, "failed"=>0},
"hits"=>
{"total"=>1925,
"max_score"=>nil,
"hits"=>
[{"_index"=>"products_..", "_type"=>"product", "_id"=>"..", "_score"=>nil, "sort"=>[..]},....]}},
@results=
[#<Product>,...]....
還有一兩件事我不能夠做到:
SearchKickResult.response
它返回我的錯誤說:
undefined method
response'`
感謝名單哥們它的工作。 :) –