我试着看懂solr官方教程
我查询:
http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id
并查看下一个响应:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">125</int>
<lst name="params">
<str name="fl">name,id</str>
<str name="indent">on</str>
<str name="q">*</str>
</lst>
</lst>
<result name="response" numFound="28" start="0">
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
<doc>...</doc>
</result>
</response>
为什么 numfound 等于 28 而 doc number 是 10?
最佳答案
如果您将查询更改为
http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id&rows=1000000
rows=
参数指定要返回的结果数。如果值为 1000000,您将有效地获取所有文档(不仅仅是前 10 个,这是默认值)。
如果你想更小心一点,你可以阅读 numFound
参数,然后多次调用以返回数据 block
http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id&start=0
http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id&start=10
http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id&start=20
这将分别返回 10、10 和 8 个文档。
关于java - 解决方案。 numfound 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20911395/