mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-23 12:16:09 +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)
|
||||
{
|
||||
$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()) {
|
||||
|
|
Loading…
Reference in a new issue