函式名稱:SolrResponse::getDigestedResponse()
適用版本:Solr 4.0.0及以上版本
用法:SolrResponse::getDigestedResponse()函式用於獲取Solr響應的摘要資訊。它返回一個包含摘要資訊的關聯陣列。
示例:
// 建立一個Solr查詢
$query = new SolrQuery('search_term');
// 執行查詢
$response = $client->query($query);
// 獲取摘要資訊
$digestedResponse = $response->getDigestedResponse();
// 列印摘要資訊
print_r($digestedResponse);
輸出結果示例:
Array
(
[responseHeader] => Array
(
[status] => 0
[QTime] => 10
[params] => Array
(
[q] => search_term
)
)
[response] => Array
(
[numFound] => 10
[start] => 0
[docs] => Array
(
[0] => Array
(
[id] => 1
[title] => Example Document 1
[content] => This is the content of example document 1.
)
[1] => Array
(
[id] => 2
[title] => Example Document 2
[content] => This is the content of example document 2.
)
// 更多文件...
)
)
)
在上面的示例中,我們首先建立了一個Solr查詢物件,並執行查詢。然後,透過呼叫SolrResponse物件的getDigestedResponse()方法,我們獲取了Solr響應的摘要資訊。最後,我們列印出了摘要資訊的陣列表示。摘要資訊包括響應頭、響應狀態、查詢時間和查詢引數等。