太阳黑子solr搜索,如何一次返回所有记录?
我在 Rails 应用程序中通过 sunspot 使用 solr,我需要返回默认设置的 30 多个记录。我可以按照中的说明进行操作 Sunspot solr 但我不想对数据进行分页。我想在一个页面中显示所有数据,而不考虑行。另外提供硬编码值也不是我正在寻找的可能的解决方案。
I am using solr via sunspot in my rails application where I need to return more than 30 records which is set by default. I can do it as told in
Sunspot solr but i don't want pagination for the data. I want to display all the data in a single page irrespective of rows. Also providing a hard coded value is not a probable solution which I'm looking for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Solr 总是分页,因此看起来无法通过 Sunspot 禁用分页(https://groups.google.com/forum/#!topic/ruby-sunspot/kVKfsrDpokc)。我唯一能想到做的就是在搜索之前获取模型的记录数,然后将 per_page 变量设置为该数字,这样就保证只返回一页。像这样的事情:
Solr always paginates, so it looks like there's no way to disable pagination through Sunspot (https://groups.google.com/forum/#!topic/ruby-sunspot/kVKfsrDpokc). The only thing I can think to do is get the number of records for your model before the search, and then set the per_page variable to that number so you're guaranteed to only return one page. Something like this: