1
我正在嘗試獲取刻面結果,我不知道如何。沒有關於solr-php-client
的文檔。在這個例子中,print_r($response->getRawResponse())
不包含分面。我不確定天氣分區是否被成功請求,或者是訪問響應中的分面數據的問題。如果有關於solr-php-client
的在線任何文檔,請也幫助我。solr php客戶端刻面
的另一個問題是如何在開始我錯過了加$additionalParameters
到search
arguements的solr-php-client
require_once('solr-php-client/Apache/Solr/Service.php');
$solr = new Apache_Solr_Service('localhost', '8983', '/solr/products');
if (! $solr->ping()) {
echo 'Solr service not responding.';
exit;
}
$offset = 0;
$limit = 10;
$queries = array(
'name:iphone'
);
$additionalParameters = array(
'facet' => 'true',
'facet.field' => array(
'category'
)
);
foreach ($queries as $query) {
$response = $solr->search($query, $offset, $limit);
if ($response->getHttpStatus() == 200) {
print_r($response->getRawResponse());
if ($response->response->numFound > 0) {
echo "$query <br />";
foreach ($response->response->docs as $doc) {
echo "$doc->id $doc->name <br />";
}
echo '<br />';
}else{
echo "zero results";
}
}
else {
echo $response->getHttpStatusMessage();
}
}