如何从solr查询中获取所有结果? [英] How to get all results from solr query?
问题描述
我执行了一些查询,例如 "Address:Jack*"
.它显示 numFound = 5214
并在结果页面中显示 100 个文档(我将默认显示结果从 10 更改为 100).
I executed some query like "Address:Jack*"
. It show numFound = 5214
and display 100 documents in results page(I changed default display results from 10 to 100).
如何获取所有文件.
推荐答案
我记得自己在做 &rows=2147483647
2,147,483,647 是整数的最大值.我记得使用了一个比那个更大的数字并且有一个 NumberFormatException 因为它不能被解析成一个 int.我不知道他们现在是否使用 Long,但 20 亿行通常已经足够了.
2,147,483,647 is integer's maximum value. I recall using a number bigger than that once and having a NumberFormatException because it couldn't be parsed into an int. I don't know if they use Long nowadays, but 2 billion rows is normally more than enough.
小注:
如果您计划在生产中执行此操作,请务必小心.如果您执行像 * : * 这样的查询并且您的索引很大,您可以在该查询中传输几 GB 的数据.
如果您知道自己不会有很多文档,请继续使用整数的最大值.
另一方面,如果您正在执行一次性脚本并且只需要转储所有结果(例如文档 ID),那么这种方法是有效的,如果您不介意等待 3-5 分钟让查询返回.
Small note:
Be careful if you are planning to do this in production. If you do a query like * : * and your index is big, you could transferring a couple of gigabytes in that query.
If you know you won't have many docs, go ahead and use integer's max value.
On the other hand, if you are doing a one-time script and just need to dump all results (for example document ID's) then this approach is valid, if you don't mind waiting 3-5 minutes for a query to return.
这篇关于如何从solr查询中获取所有结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!