emran / php-solr-helper
PHP Solr Helper
Installs: 113
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Open Issues: 0
pkg:composer/emran/php-solr-helper
Requires
- php: >=5.3.0
- emran/php-solr-client: dev-master
This package is not auto-updated.
Last update: 2025-10-11 17:00:08 UTC
README
This is a small helper to ease querying Apache Solr using the solr-php-client library.
Example 1:
Searches the solr for records matching the two fields make and model.
$solrHelper = new \Emran\SolrHelper(new \Apache_Solr_Service('localhost', 8080, '/solr/'));
$result = $solrHelper->addSingleValueCriteria('make', 'BMW')
->addSingleValueCriteria('model', 'X5')
->search();
Example 2:
Searches the solr for records matching the two fields make, model and a price range between 10000 and 20000. Also limits the fields to be returned to acode and price.
$solrHelper = new \Emran\SolrHelper(new \Apache_Solr_Service('localhost', 8080, '/solr/'));
$result = $solrHelper->addSingleValueCriteria('make', 'BMW')
->addMultiValueCriteria('model', array('X5', 'X3'))
->addRangeCriteria('price', array(20000, 50000))
->start(0)
->limit(10)
->order('price desc')
->search();