如何从Drupal 8中的php查询solr服务器?
我安装了search_api,search_api_solr和search_api_attachments。还安装了Solr v.8.4.0。
我按照以下指南为Centos 7安装了php SolrClient:https://stackoverflow.com/questions/22959330/fatal-error-class-solrclient-not-found,但每次运行时仍会得到“类'SolrClient‘不存在”
new SolrClient($options);
我在Drupal 7 (apachesolr_get_solr())中找到了有关从php查询Solr的文档,但在Drupal 8中没有找到任何文档。
发布于 2020-01-25 22:21:11
我设法修复了SolrClient安装的问题:https://stackoverflow.com/questions/41052999/php-warning-unable-to-load-dynamic-library-usr-lib64-php-modules-solr-so-und%C2%A0
这就是我现在如何从php查询solr服务器(就在php SolrClient手册之外):
$options = array
(
'hostname' => 'localhost',
'port' => '8983',
'path' => 'solr/sbn01'
);
$client = new SolrClient($options);
$query = new SolrQuery();
$query->setQuery('*file/10*');
$query->setStart(0);
$query->setRows(50);
$query->addField('id');
$query->addField('its_fid');
$query->addField('ss_uri');
$query_response = $client->query($query);
$response = $query_response->getResponse();
print_r($response);
https://drupal.stackexchange.com/questions/290495
复制相似问题