Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
TASK: Shorten code
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
DanielSiepmann committed Dec 29, 2018
1 parent 13cd870 commit a858d74
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Classes/Connection/Elasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,16 @@ public function deleteIndex()

public function deleteIndexByDocumentType(string $documentType)
{
$query = Query::create([
$this->deleteIndexByQuery(Query::create([
'query' => [
'term' => [
'search_document_type' => $documentType
]
]
]);
$this->deleteIndexByQuery($query);
'search_document_type' => $documentType,
],
],
]));
}

public function deleteIndexByQuery(Query $query)
private function deleteIndexByQuery(Query $query)
{
$index = $this->connection->getClient()->getIndex($this->indexFactory->getIndexName());
if (!$index->exists()) {
Expand Down

0 comments on commit a858d74

Please sign in to comment.