Skip to content

Commit

Permalink
Merge pull request #27 from designmynight/document-type-global-scope
Browse files Browse the repository at this point in the history
Fix indexing
  • Loading branch information
robbytaylor authored Jan 30, 2018
2 parents 5663a05 + 5a5107d commit 8ac0df8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/DesignMyNight/Elasticsearch/EloquentBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function setModel(Model $model)

$this->query->from($model->getSearchIndex());

$this->query->whereType($model->getSearchType());
$this->query->type($model->getSearchType());

return $this;
}
Expand Down
7 changes: 5 additions & 2 deletions src/DesignMyNight/Elasticsearch/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace DesignMyNight\Elasticsearch;

trait Searchable {

public static function getElasticsearchConnectionName(): string
{
return 'elasticsearch';
Expand Down Expand Up @@ -127,6 +128,8 @@ public static function newElasticsearchQuery(): EloquentBuilder
{
$model = new static();

return $model->on(static::getElasticsearchConnectionName())->setModel($model);
return $model
->on(static::getElasticsearchConnectionName())
->whereType($model->getSearchType());
}
}
}

0 comments on commit 8ac0df8

Please sign in to comment.