donglu8334 2016-03-23 07:08
浏览 30
已采纳

PHP SolrClient连接错误

I am using solr server for one of my projects. The manual import and query selection are working fine. Also I am able to get the results from the solr server. The actual problem is, whenever I tried to update the solr server using the PHP-SolrClient, it returns error. The code I have used the below given query for solr updation.

$options = array(
'hostname' => 'xxx.xxx.xxx.xxx',
'login'    => '',
'password' => '',
'port'     => 8983); 
$client = new SolrClient($options);
$client->ping();

But the code returns the following error.

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

Can anyone help me to find out what causes the error?

  • 写回答

1条回答 默认 最新

  • doucu5836 2016-03-23 11:58
    关注

    Please specify the collection path in the options

    $options = array(
    'hostname' => 'xxx.xxx.xxx.xxx',
    'login'    => '',
    'password' => '',
    'port'     => 8983,
    'path'     => 'solr/<collection name>'
    ); 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里