我正在为其中一个项目使用solr服务器.手动导入和查询选择工作正常.我也可以从solr服务器获取结果.
实际的问题是,每当我尝试使用PHP-SolrClient更新Solr服务器时,它都会返回错误.
我已使用以下给定查询进行solr更新的代码.
$options = array(
'hostname' => 'xxx.xxx.xxx.xxx',
'login' => '',
'password' => '',
'port' => 8983);
$client = new SolrClient($options);
$client->ping();
但是代码返回以下错误.
Warning: SolrClient::ping(): Entity: line 1: parser error : Start tag expected, ‘<‘ not found in /var/www/html/test.php on line 132 Call Stack: 0.0095 234296 1. {main}() /var/www/html/test.php:0 0.0096 237776 2. SolrClient->ping() /var/www/html/test.php:132 Warning: SolrClient::ping(): HTTP/1.1 404 Not Found in /var/www/html/test.php on line 132 Call Stack: 0.0095 234296 1. {main}() /var/www/html/test.php:0 0.0096 237776 2. SolrClient->ping() /var/www/html/test.php:132 Warning: SolrClient::ping(): ^ in /var/www/html/test.php on line 132 Call Stack: 0.0095 234296 1. {main}() /var/www/html/test.php:0 0.0096 237776 2. SolrClient->ping() /var/www/html/test.php:132 Warning: SolrClient::ping(): Xpath Error: no elements found in /var/www/html/test.php on line 132 Call Stack: 0.0095 234296 1. {main}() /var/www/html/test.php:0 0.0096 237776 2. SolrClient->ping() /var/www/html/test.php:132 Fatal error: Uncaught exception ‘SolrClientException’ with message ‘ in /var/www/html/test.php on line 132 SolrClientException: Unsuccessful ping request : Response Code 404. HTTP/1.1 404 Not Found Content-Type: text/html; charset=ISO-8859-1 Cache-Control: must-revalidate,no-cache,no-store Content-Length: 300 in /var/www/html/test.php on line 132 Call Stack: 0.0095 234296 1. {main}() /var/www/html/test.php:0 0.0096 237776 2. SolrClient->ping() /var/www/html/test.php:132
谁能帮助我找出导致错误的原因?
解决方法:
请在选项中指定收集路径
$options = array(
'hostname' => 'xxx.xxx.xxx.xxx',
'login' => '',
'password' => '',
'port' => 8983,
'path' => 'solr/<collection name>'
);