From 8623605f61c45fae142efbb1d18dbeaaeb3f0706 Mon Sep 17 00:00:00 2001 From: Simon Erkelens Date: Sun, 22 Oct 2023 22:38:26 +1300 Subject: [PATCH] Remove add/set/get class methods to move to core --- src/Indexes/ElasticIndex.php | 49 +++--------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/src/Indexes/ElasticIndex.php b/src/Indexes/ElasticIndex.php index 1d1de3e..86539e4 100644 --- a/src/Indexes/ElasticIndex.php +++ b/src/Indexes/ElasticIndex.php @@ -52,10 +52,9 @@ abstract class ElasticIndex extends CoreIndex protected $clientQuery; /** - * @var array Classes to index + * Set-up of core and fields through init + * @throws NotFoundExceptionInterface */ - protected $class = []; - public function __construct() { $this->client = Injector::inst()->get(ElasticCoreService::class)->getClient(); @@ -66,7 +65,7 @@ public function __construct() } /** - * @param HTTPRequest|null $request + * @param HTTPRequest $request * @return bool * @throws ClientResponseException * @throws MissingParameterException @@ -115,29 +114,6 @@ public function indexExists(): bool abstract public function getIndexName(): string; - /** - * Get classes - * - * @return array - */ - public function getClasses(): array - { - return $this->class; - } - - /** - * Set the classes - * - * @param array $class - * @return $this - */ - public function setClasses($class): self - { - $this->class = $class; - - return $this; - } - /** * @param ElasticQuery $query * @return SearchResult @@ -150,24 +126,7 @@ public function doSearch(ElasticQuery $query) $result = $this->client->search($this->clientQuery); - $result = new SearchResult($result, $query, $this); - - return $result; - } - - /** - * Add a class to index or query - * $options is not used anymore, added for backward compatibility - * - * @param $class - * @param array $options unused - * @return $this - */ - public function addClass($class, $options = []): self - { - $this->class[] = $class; - - return $this; + return new SearchResult($result, $query, $this); } public function getClientQuery(): array