Regarding documentation one has to set the path (i.e. core) on initialization of SolrClient
:
$client = new SolrClient([
'hostname' => 'localhost',
'port' => 8983,
'path' => '/solr/coreXYZ',
]);
As I need access to multiple cores (ex. /solr/core_1
, /solr/core_2
), is there any way to dynamically change the path? I was not able to find any option for query
or request
method.
Edit
I found a way which worked also:
$client->setServlet(SolrClient::SEARCH_SERVLET_TYPE, '../' . $core . '/select');
$client->setServlet(SolrClient::UPDATE_SERVLET_TYPE, '../' . $core . '/update');
But this is a dirty hack only for me