mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-23 11:16:12 +01:00
TASK: Shorten code
* Do not use variable, instead provide result to method call. * Do not provide public method which is not part of API. Otherwise one might use it in custom PHP code and switch connection later on. Then the method call will no longer work.
This commit is contained in:
parent
13cd87019f
commit
a858d748ee
1 changed files with 6 additions and 7 deletions
|
@ -179,17 +179,16 @@ class Elasticsearch implements Singleton, ConnectionInterface
|
||||||
|
|
||||||
public function deleteIndexByDocumentType(string $documentType)
|
public function deleteIndexByDocumentType(string $documentType)
|
||||||
{
|
{
|
||||||
$query = Query::create([
|
$this->deleteIndexByQuery(Query::create([
|
||||||
'query' => [
|
'query' => [
|
||||||
'term' => [
|
'term' => [
|
||||||
'search_document_type' => $documentType
|
'search_document_type' => $documentType,
|
||||||
]
|
],
|
||||||
]
|
],
|
||||||
]);
|
]));
|
||||||
$this->deleteIndexByQuery($query);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteIndexByQuery(Query $query)
|
private function deleteIndexByQuery(Query $query)
|
||||||
{
|
{
|
||||||
$index = $this->connection->getClient()->getIndex($this->indexFactory->getIndexName());
|
$index = $this->connection->getClient()->getIndex($this->indexFactory->getIndexName());
|
||||||
if (!$index->exists()) {
|
if (!$index->exists()) {
|
||||||
|
|
Loading…
Reference in a new issue