Skip to content

Commit

Permalink
Removed static create()
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Erdodi committed Dec 23, 2018
1 parent 5a8ef3c commit 32f3997
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Engine/SphinxEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public function __construct($hosts = [], array $options = [])
$connection = new Connection();
$connection->setParams($hosts);
$this->connections = $connection;
$this->sphinx = new SphinxQL($connection);
$this->sphinxHelper = new Helper($connection);
}

/**
Expand Down Expand Up @@ -57,7 +59,7 @@ public function update($models)
$index = $example->searchableAs();
$columns = array_keys($example->toSearchableArray());

$sphinxQuery = SphinxQL::create($this->connections)
$sphinxQuery = $this->sphinx
->replace()
->into($index)
->columns($columns);
Expand Down Expand Up @@ -89,7 +91,7 @@ public function delete($models)
$key = $models->pluck($model->getKeyName())
->values()->all();

SphinxQL::create($this->connections)
$this->sphinx
->delete()
->from($index)
->where('id', 'IN', $key)
Expand Down Expand Up @@ -221,7 +223,7 @@ protected function baseQuery(Builder $builder, $perPage = null, $page = null)

$columns = array_keys($column_index);

$query = SphinxQL::create($this->connections)
$query = $this->sphinx
->select("*")
->from($index)
->match($columns, $builder->query);
Expand All @@ -245,7 +247,7 @@ protected function baseQuery(Builder $builder, $perPage = null, $page = null)
$resultset, $builder
);

$meta = collect($query->enqueue(Helper::create($this->connections)->showMeta())->execute()->getStored());
$meta = collect($query->enqueue($this->sphinxHelper->showMeta())->execute()->getStored());

$meta->map(function ($item, $key) use (&$result)
{
Expand Down

0 comments on commit 32f3997

Please sign in to comment.