2017 © Pedro Peláez
 

package elastic-repository

elastic search active repository package

image

aqarmap/elastic-repository

elastic search active repository package

  • Thursday, April 5, 2018
  • by khal3d
  • Repository
  • 2 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

Packagist License, (*1)

:tada: Elasticsearch Repository Package

Elasticsearch Repository is a simple, smart implementation of Active Repository for Elasticsearch., (*2)

: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, (*3)

composer require mustafah15/elastic-repository

integration

Elasticsearch Repository package is framework-agnostic and as such can be integrated easily natively or with your favorite framework., (*4)

:sparkles: Usage

  • Extend ElasticRepository class as a repository for your type or index.
class schoolsRepository extends ElasticRepository 
{
    // method contains some bussiness logic 
    public function returnQueryWherename()
    {
        $this->where('name', 'EGSchool', 0.5)->getResultQuery();
    }
}

:clipboard: Documentation

ElasticRepository

when you extend ElasticRepository class you will have get various functionality, (*5)

setIndex(), setType()

The setIndex() and setType() methods for setting up your index name and type name into Repository:, (*6)

setSort()

The setSort() method adds main sort criteria for the query: sorting with _score by default when adding score function, (*7)

// pass field name to sort by 
$queryBuilder->setSort('fieldName');

setOrder()

The setOrder() method to specify sort direction:, (*8)

$queryBuilder->setSort('fieldName')->setOrder('desc');

setTransformer($transformer)

The setTransformer($transformer) to add transformer for your result transformer must implement TransformerContract, (*9)

get()

method get() to get result from your final query after building it using query builder:, (*10)

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, (*11)

getResultQuery()

the getResultQuery() return Query object, (*12)

getResultQueryWithScore($scoreFunction)

takes Query\FunctionScore $functionScore as a parameter to apply scoring to your query, (*13)

QueryBuilder

Every ElasticRepository class have it's own query builder which have a lot of operations and functionlity that you can use., (*14)

where(), whereNot()

The where() and whereNot() methods adding must and must not to the main filter:, (*15)

//attribute paramter then the expected value and optional value for the field boost
$queryBuilder->where($attribute, $value = null, $boost = 1.0);

whereIn(), whereNotIn()

The whereIn() and whereNotIn() methods adding Range to the main filter:, (*16)


//attribute paramter then a optional value for the fields from and to $queryBuilder->whereIn($attribute, $from = '', $to = '');

exist('fieldName')

$queryBuilder->exist('fieldName');

match($attribute, $keyword)

$queryBuilder->match('fieldName', $keywordToMatch);

TODO

  • caching support

Contributing

Please see CONTRIBUTING for details., (*17)

License

The MIT License (MIT). Please see License File for more information., (*18)

The Versions

05/04 2018

dev-master

9999999-dev

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

02/04 2018

dev-existArray

dev-existArray

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

02/04 2018

1.0.1

1.0.1.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

30/12 2017

1.0

1.0.0.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

30/12 2017

0.5.1

0.5.1.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

30/12 2017

0.5.0

0.5.0.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

13/12 2017

0.3.2

0.3.2.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

07/12 2017

0.3.1

0.3.1.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

06/12 2017

0.3.0

0.3.0.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

09/11 2017

0.2.0

0.2.0.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

07/11 2017

0.1.6

0.1.6.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

06/11 2017

0.1.5

0.1.5.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

31/10 2017

0.1.4

0.1.4.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

28/10 2017

0.1.3

0.1.3.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

28/10 2017

0.1.2

0.1.2.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

28/10 2017

0.1.1

0.1.1.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain

26/10 2017

0.1

0.1.0.0

elastic search active repository package

  Sources   Download

MIT

The Requires

 

The Development Requires

by mustafa hussain