PHP curl_setopt() 没有从 SOLR 返回准确的 result_array

PHP curl_setopt() is not returning the exact result_array from SOLR

我正在使用 PHP cURLSolr.

检索搜索结果数组
 - cURL Version : 7.47.1 

下面的代码正在搜索特定城市的商店总数。 请看我的代码..

    $ch1 = curl_init();
    curl_setopt($ch1, CURLOPT_URL, "http://localhost:8983/solr/Search/select?q=searchshop%3A*&fq=" . $encode_fq_city . "&wt=php&fl=LoginInfoId");
    curl_setopt($ch1, CURLOPT_HEADER, false);
    curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
    $shop = curl_exec($ch1);
    curl_close($ch1);

    print_r($shop);

我做了 print_r $shop_arr 数组,结果只显示了 10 条记录。实际的 Solr result_array 包含 14 条记录。

同时附上结果数组..

            [response] => Array
                (
                    [numFound] => 14
                    [start] => 0
                    [docs] => Array
                        (
                            [0] => Array
                                (
                                    [LoginInfoId] => 246
                                )

                            [1] => Array
                                (
                                    [LoginInfoId] => 230
                                )

                            [2] => Array
                                (
                                    [LoginInfoId] => 236
                                )

                            [3] => Array
                                (
                                    [LoginInfoId] => 217
                                )

                            [4] => Array
                                (
                                    [LoginInfoId] => 241
                                )

                            [5] => Array
                                (
                                    [LoginInfoId] => 219
                                )

                            [6] => Array
                                (
                                    [LoginInfoId] => 239
                                )

                            [7] => Array
                                (
                                    [LoginInfoId] => 231
                                )

                            [8] => Array
                                (
                                    [LoginInfoId] => 232
                                )

                            [9] => Array
                                (
                                    [LoginInfoId] => 257
                                )

                        )

                )

结果显示 [numfound]=14 但只有 10 条记录。

在我的场景中将 result_array 从 Solr 获取到 PHP 有什么错误吗?

是否是 cURL 错误?

Solr 默认 returns 10 个文档:

rows

This parameter is used to paginate results from a query. It specify the maximum number of documents from the complete result set to return to the client for every request. You can consider it as the maximum number of result appear in the page.

The default value is "10", which is used if the parameter is not specified. If you want to tell Solr to return all possible results from the query without an upper bound, specify rows to be 10000000 or some other ridiculously large value that is higher than the possible number of rows that are expected.

因此向您的查询添加一个行参数,例如 rows=100:

curl_setopt($ch1, CURLOPT_URL, "http://localhost:8983/solr/Search/select?q=searchshop%3A*&fq=" . $encode_fq_city . "&wt=php&fl=LoginInfoId&rows=100");

参考文献:

更新:如果您想进行永久更改,您可以通过编辑 solrconfig.xml 来配置 Solr,有关行示例,请参阅: