索尔。numfound 是什么意思?

gst*_*low 1 java solr

我尝试了解 solr 官方教程。

我查询:

http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id
Run Code Online (Sandbox Code Playgroud)

并查看下一个回复:

<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>
Run Code Online (Sandbox Code Playgroud)

为什么 numfound 等于 28 但文档编号是 10?

Flo*_*ris 5

如果您将查询更改为

http://localhost:8983/solr/collection1/select/?indent=on&q=*&fl=name,id&rows=1000000
Run Code Online (Sandbox Code Playgroud)

rows=参数指定要返回的结果数。值为 1000000 时,您将有效地获得所有文档(不仅仅是前 10 个,这是默认值)。

如果你想更小心一点,你可以读取numFound参数,然后多次调用以返回数据块

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
Run Code Online (Sandbox Code Playgroud)

这将分别返回 10、10 和 8 个文档。