如何使用acts_as_solr获取所有文档 [英] how to get all docs with acts_as_solr
本文介绍了如何使用acts_as_solr获取所有文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做这样的事情:
Item.find_by_solr('name:ab*')
并说它返回297个结果:
and it says it returns 297 results:
=> #<ActsAsSolr::SearchResults:0xb6516858 @total_pages=1, @solr_data={:docs=>[doc1, doc2, doc3...]}, :max_score=>1.6935261, :total_pages=>1, :total=>297}, @current_page=1>
Item.count_by_solr('name:ab*') also returns 297.
但迭代时仅显示10个项目:
Yet when iterate it only shows 10 items:
Item.find_by_solr('reference_name:ab*').each do |i| puts i end
我尝试添加{:per_page => 80}和:limit =>:all,但仍然显示那些10.知道我缺少什么吗?
I tried adding {:per_page=>80} and :limit=>:all but it still shows those 10. Any idea what I'm missing?
推荐答案
如@mausch所说,Solr(以及扩展名acts_as_solr
)默认为10个结果.您可以使用:limit选项来增加此值,但只使用一个Fixnum,而不使用:all符号.因此,请使用Fixnum指定:limit.
as @mausch said Solr (and by extension acts_as_solr
) defaults to 10 results. You can use the :limit option to increase this, but it only takes a Fixnum, not the :all symbol. So specify :limit with a Fixnum.
这篇关于如何使用acts_as_solr获取所有文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文