[英]Solarium Ping request error : Solr HTTP error: Not Found (404)
我是Solr的新手,我正嘗試使用Solarium將其與我的PHP應用程序集成。 我嘗試運行ping查詢,但失敗並給出Solr HTTP錯誤:未找到(404)響應。
我的PHP代碼如下:
$config = array(
"endpoint" => array("localhost" => array("host"=>"localhost",
"port"=>8983, "path"=>"/solr", "core"=>"techproducts",)));
try{
$client = new Solarium_Client($config);
}catch (Exception $e){
echo $e->getMessage();
}
if ($client == null) {
echo 'Client null';
} else {
echo 'Client created</br>';
//v($client);
}
// create a ping query
$ping = $client->createPing();
if ($ping == null) {
echo 'ping null';
} else {
echo 'ping created</br>';
//v($ping);
}
// execute the ping query
try{
$result= $client->ping($ping);
echo 'Ping query successful';
echo '<br/><pre>';
//var_dump($result->getData());
}catch(Solarium_Exception $e){
echo $e->getMessage();
}
我的Solr服務器地址是: http:// localhost:8983 / solr /核心:techproducts
我得到的輸出是:客戶端創建的ping創建的Solr HTTP錯誤:未找到(404)誰能建議什么可能的解決方案?
我猜您的solrconfig.xml文件中缺少ping處理程序。 請檢查。 您可以在下面的配置中進行相同的操作。
<!-- ping/healthcheck -->
<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
<lst name="invariants">
<str name="q">solrpingquery</str>
</lst>
<lst name="defaults">
<str name="echoParams">all</str>
</lst>
<!-- An optional feature of the PingRequestHandler is to configure the
handler with a "healthcheckFile" which can be used to enable/disable
the PingRequestHandler.
relative paths are resolved against the data dir
-->
<!-- <str name="healthcheckFile">server-enabled.txt</str> -->
</requestHandler>
然后,您可以ping solr。 您可以在url中編輯核心名稱。 點擊這里
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.