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:
Daniel Siepmann 2018-12-29 18:06:26 +01:00
parent 13cd87019f
commit a858d748ee
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -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()) {