dev-master
9999999-dev https://github.com/BostjanOb/SolrClientApache SOLR client for ZF2
MIT
The Requires
- php >=5.3.3
- zendframework/zendframework 2.*
The Development Requires
zf2 module solr
Wallogit.com
2017 © Pedro Peláez
Apache SOLR client for ZF2
Features :, (*1)
In your solrconfig.xml you must have php serialized query response writer enabled:
<queryResponseWriter name="phps" class="solr.PHPSerializedResponseWriter"/>, (*2)
"bostjanob/solr-client": "dev-master" to your composer.json
php composer.phar install
config/application.config.php by adding SolrClient to modules
Setup your connection by adding the module configuration to any valid ZF2 config file. This can be any file in autoload/ or a module configuration (such as the Application/config/module.config.php file)., (*3)
<?php
return array(
'solr' => array(
'connection' => array(
'solr_default' => array(
'host' => 'HOSTNAME',
'port' => 'PORT',
// for basic auth
'user' => 'USERNAME',
'password' => 'PASSWORD',
// web path where solr is installed
'path' => '/',
// scheme: http or https
'scheme' => 'http'
),
),
),
);
Access the solrClient using the following alias:, (*4)
$client = $this->getServiceLocator()->get('solr.solr_default');
Coming soon..., (*5)
Deleting documents by ID, (*6)
$solrClient->deleteById(1);
$solrClient->commit();
// more documents at once, and commit
$solrClient->deleteById(array(1,2,3,4), true);
//or all data
$solrClient->deleteByQuery("*:*");
$solrClient->commit();
More info about "commit" and "optimize", (*7)
public function commit($optimize = false, $waitFlush = true, $waitSearcher = true)
public function optimize($waitFlush = true, $waitSearcher = true, $maxSegments = 1)
Coming soon..., (*8)
Apache SOLR client for ZF2
MIT
zf2 module solr