Download the PHP package aqarmap/elastic-repository without Composer
On this page you can find all versions of the php package aqarmap/elastic-repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aqarmap/elastic-repository
More information about aqarmap/elastic-repository
Files in aqarmap/elastic-repository
Package elastic-repository
Short Description elastic search active repository package
License MIT
Informations about the package elastic-repository
:tada: Elasticsearch Repository Package
Elasticsearch Repository is a simple, smart implementation of Active Repository for Elasticsearch.
:fire: Features
- provide active repository pattern over your elasticsearch indices, types.
- bring query builder into your elasticsearch repositories.
- Minimize lines of code for building elasticsearch queries with system with big business logic.
- Prevent code duplication.
- Reduce potential programming errors.
:grey_exclamation: Installation
grap it via composer
integration
Elasticsearch Repository package is framework-agnostic and as such can be integrated easily natively or with your favorite framework.
:sparkles: Usage
- Extend ElasticRepository class as a repository for your type or index.
:clipboard: Documentation
ElasticRepository
when you extend ElasticRepository
class you will have get various functionality
setIndex()
, setType()
The setIndex()
and setType()
methods for setting up your index name and type name into Repository:
setSort()
The setSort()
method adds main sort criteria for the query:
sorting with _score by default when adding score function
setOrder()
The setOrder()
method to specify sort direction:
setTransformer($transformer)
The setTransformer($transformer)
to add transformer for your result transformer must implement TransformerContract
get()
method get()
to get result from your final query after building it using query builder:
getResultWithScore()
The getResultWithScore($scoreFunction)
method to get results after adding a score function:
takes Query\FunctionScore $functionScore
as a parameter to be applied to your results
getResultQuery()
the getResultQuery()
return Query object
getResultQueryWithScore($scoreFunction)
takes Query\FunctionScore $functionScore
as a parameter to apply scoring to your query
QueryBuilder
Every ElasticRepository class have it's own query builder which have a lot of operations and functionlity that you can use.
where()
, whereNot()
The where()
and whereNot()
methods adding must and must not to the main filter:
whereIn()
, whereNotIn()
The whereIn()
and whereNotIn()
methods adding Range to the main filter:
exist('fieldName')
match($attribute, $keyword)
TODO
- caching support
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.