繁体   English   中英

是否需要使用独立的码头安装来使用php pecl solr扩展?

[英]Is it necessary to use a standalone jetty install for using the php pecl solr extension?

我目前仅在solr文件夹的“ example”文件夹中运行“ start.jar”。 尝试使用来自PHP的pecl solr扩展联系solr时,我在扩展安装的“ php_solr_client.c”文件中遇到异常。 我正在使用SOLR 3.1,我相信配置是正确的。“主机名”-本地主机,端口-8983,路径-'/ solr /'

我可以通过“ http:// localhost:8983 / solr / admin /”访问solr admin

我担心的是我的机器没有将8983列为开放端口。 这不是很奇怪吗? 这是我的连接配置。

<?php
$options = array
(
 'hostname' => 'localhost',
 'port'     => 8983,
 'path'     => '/solr/'
 );

$client = new SolrClient($options);

$doc = new SolrInputDocument();

$doc->addField('id', 334455);
var_dump($doc->toArray());
try{
$pingresponse   = $client->ping();
$updateResponse = $client->addDocument($doc);
}
catch(Exception $e){
        var_dump($e->getInternalInfo());
}
//print_r($updateResponse->getResponse());
?>

这是我得到的输出。

array (size=3)
  'document_boost' => float 0
  'field_count' => int 1
  'fields' => 
    array (size=1)
      0 => 
        object(SolrDocumentField)[3]
          public 'name' => string 'id' (length=2)
          public 'boost' => float 0
          public 'values' => 
            array (size=1)
              ...

( ! ) Warning: SolrClient::ping(): in /var/www/html/simple/new.php on line 16
Call Stack
#   Time    Memory  Function    Location
1   0.0003  234560  {main}( )   ../new.php:0
2   0.0005  239096  SolrClient->ping( ) ../new.php:16

array (size=3)
  'sourceline' => int 1704
  'sourcefile' => string '/builddir/build/BUILD/php-pecl-solr-1.0.2/solr-1.0.2/php_solr_client.c' (length=70)
  'zif_name' => string 'zim_SolrClient_ping' (length=19)

SolrClient不在乎您的Solr安装SolrClient何处或为它提供服务。 您可以在构造函数中定义连接参数。

如果连接时遇到问题,请检查用于托管Solr的东西的参数(无论是Jetty还是烤土豆),并与传递给构造函数的参数匹配。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM