swiss-php-friends / solr-query-builder
Common library to build Apache Solr queries
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 5 236
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 3
Open Issues: 1
Language:JavaScript
Requires
- php: >=5.4
Requires (Dev)
- evert/phpdoc-md: ~0.0.7
- phpdocumentor/phpdocumentor: 2.7.1
- phpunit/phpunit: ~3.7
This package is not auto-updated.
Last update: 2019-02-08 22:04:39 UTC
README
A simple PHP library to build Apache Solr queries
Features
- Fluid query-builder API
- Wildcard support
- Fuzzy search
- Integer- and string-range support
- Fully unit-tested
- Solr version support (3 & 4)
Installation
Use composer:
composer.phar require swiss-php-friends/solr-query-builder
Usage
The library provides a simple, fluid query builder. E.g.:
use SPF\SolrQueryBuilder\QueryBuilder; use SPF\SolrQueryBuilder\Query\QueryInterface $qb = new QueryBuilder; // simple wildcard query $query = $qb->select() ->where('text_en', 'foo') ->orWhere('text_en', 'bar', QueryInterface::WILDCARD_SURROUNDED) ->getQueryString(); // nesting $query = $qb->select() ->nest() ->where('text_de', 'foo') ->andWhere('text_en', 'bar') ->endNest() ->orWhere('id', 2) ->getQueryString(); // value building (e.g. fuzzy-search or ranges) $query = $qb->select() ->where('text_de', $qb->createFuzzySearchValue('foo', 0.7)) ->orWhere('text_en', $qb->createStringRange('bar', 'baz')) ->orWhere('id', $qb->createNumericRange(10, 100)) ->getQueryString();
Documentation
For a complete function reference see the API-Docs.
The tests also provide a good overview of the query builder and hot it works.
May the coverage-report provide you with some more information...
Contribution
You are very welcome to contribute. Report bugs and feature-requests to the GitHub Issue Tracking, or propose a PullRequest.
For contributions, please use the Symfony Coding Standard and write unit-tests.
Release Notes
See GitHub Releases