Skip to content

Commit

Permalink
fix: remove document type query (#93)
Browse files Browse the repository at this point in the history
* fix: remove document type query

* chore: remove type query from grammar class
  • Loading branch information
Jaspar Gupta authored Sep 16, 2019
1 parent 1d54e75 commit 912c622
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
18 changes: 0 additions & 18 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,24 +427,6 @@ public function search($query, $options = [], $boolean = 'and'): self
return $this;
}

/**
* Add a type clause to the query.
*
* @param string $documentType
* @param string $boolean
* @return \Illuminate\Database\Query\Builder|static
*/
public function whereType($documentType, $boolean = 'and')
{
$this->wheres[] = [
'type' => 'Type',
'value' => $documentType,
'boolean' => $boolean
];

return $this;
}

/**
* @param string $parentType Name of the parent relation from the join mapping
* @param mixed $id
Expand Down
18 changes: 0 additions & 18 deletions src/QueryGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,24 +270,6 @@ protected function applyWhereRelationship(Builder $builder, array $where, string
return $query;
}

/**
* Compile a type clause
*
* @param Builder $builder
* @param array $where
* @return array
*/
protected function compileWhereType(Builder $builder, array $where): array
{
$query = [
'type' => [
'value' => $where['value']
]
];

return $query;
}

/**
* Compile a parent clause
*
Expand Down
9 changes: 4 additions & 5 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,11 @@ public function newCollection(array $models = [])
return new Collection($models);
}

/**
* @return EloquentBuilder
*/
public static function newElasticsearchQuery(): EloquentBuilder
{
$model = new static();

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

0 comments on commit 912c622

Please sign in to comment.