PHP Class ScoutEngines\Elasticsearch\ElasticsearchEngine

Inheritance: extends Laravel\Scout\Engines\Engine
Show file Open project: ericktamayo/laravel-scout-elastic Class Usage Examples

Protected Properties

Property Type Description
$index string Index where the models will be saved.

Public Methods

Method Description
__construct ( Elasticsearch\Client $elastic, $index ) : void Create a new engine instance.
delete ( Illuminate\Database\Eloquent\Collection $models ) : void Remove the given model from the index.
getTotalCount ( mixed $results ) : integer Get the total count from a raw result returned by the engine.
map ( mixed $results, Model $model ) : Illuminate\Database\Eloquent\Collection Map the given results to instances of the given model.
paginate ( Laravel\Scout\Builder $builder, integer $perPage, integer $page ) : mixed Perform the given search on the engine.
search ( Laravel\Scout\Builder $builder ) : mixed Perform the given search on the engine.
update ( Illuminate\Database\Eloquent\Collection $models ) : void Update the given model in the index.

Protected Methods

Method Description
filters ( Laravel\Scout\Builder $builder ) : array Get the filter array for the query.
performSearch ( Laravel\Scout\Builder $builder, array $options = [] ) : mixed Perform the given search on the engine.

Method Details

__construct() public method

Create a new engine instance.
public __construct ( Elasticsearch\Client $elastic, $index ) : void
$elastic Elasticsearch\Client
return void

delete() public method

Remove the given model from the index.
public delete ( Illuminate\Database\Eloquent\Collection $models ) : void
$models Illuminate\Database\Eloquent\Collection
return void

filters() protected method

Get the filter array for the query.
protected filters ( Laravel\Scout\Builder $builder ) : array
$builder Laravel\Scout\Builder
return array

getTotalCount() public method

Get the total count from a raw result returned by the engine.
public getTotalCount ( mixed $results ) : integer
$results mixed
return integer

map() public method

Map the given results to instances of the given model.
public map ( mixed $results, Model $model ) : Illuminate\Database\Eloquent\Collection
$results mixed
$model Illuminate\Database\Eloquent\Model
return Illuminate\Database\Eloquent\Collection

paginate() public method

Perform the given search on the engine.
public paginate ( Laravel\Scout\Builder $builder, integer $perPage, integer $page ) : mixed
$builder Laravel\Scout\Builder
$perPage integer
$page integer
return mixed

performSearch() protected method

Perform the given search on the engine.
protected performSearch ( Laravel\Scout\Builder $builder, array $options = [] ) : mixed
$builder Laravel\Scout\Builder
$options array
return mixed

update() public method

Update the given model in the index.
public update ( Illuminate\Database\Eloquent\Collection $models ) : void
$models Illuminate\Database\Eloquent\Collection
return void

Property Details

$index protected property

Index where the models will be saved.
protected string $index
return string