我正在尝试通过 php 查找我的 solr 实例中的文档。当我去我的 solr 管理员并进行搜索时,我得到以下信息:
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">443</int><lst name="params">
<str name="indent">on</str><str name="start">0</str>
<str name="q">*:*</str><str name="rows">10</str>
<str name="version">2.2</str></lst></lst>
<result name="response" numFound="4" start="0">
<doc>
<str name="description">An Aweomse dish</str>
<arr name="ingredients"><str>Radish</str><str>Beans</str><str>Curry</str></arr>
<str name="name">Alfredo Chehse</str>
<str name="recipe_id">10</str><str name="thumbnail">123343f342</str>
</doc>
<doc>
<str name="description">An Aweomse dish</str>
<arr name="ingredients"><str>Radish</str><str>Beans</str>
<str>Curry</str></arr><str name="name">Alfredo Chehse</str>
<str name="recipe_id">11</str><str name="thumbnail">123343f342</str>
</doc>
</result>
</response>
所以我知道数据在那里。现在在我的 PHP 中我有这个:
$query = new SolrQuery();
$query->setQuery('Radish');
$query->setStart(0);
$query->setRows(50);
$query->addField('ingredients') -> addField('name');
$query_response = $client->query($query);
$query_response->setParseMode(SolrQueryResponse::PARSE_SOLR_DOC);
$response = $query_response->getResponse();
print_r($response);
但我总是得到一个空的结果集:
SolrObject 对象 (
[responseHeader] => SolrObject Object
(
[status] => 0
[QTime] => 1
[params] => SolrObject Object
(
[fl] => ingredients,name
[indent] => on
[start] => 0
[q] => radish
[wt] => xml
[rows] => 50
[version] => 2.2
)
)
[response] => SolrObject Object
(
[numFound] => 0
[start] => 0
[docs] =>
)
我的问题是,无论我搜索什么,为什么我的结果总是空的?