From a5a981c65dcab5c908910e195c487c0ba396952b Mon Sep 17 00:00:00 2001 From: Emanuele Panzeri Date: Mon, 23 Mar 2020 09:25:18 +0100 Subject: [PATCH] Removed helper function Terms::buildTermsLookup() (#1767) --- CHANGELOG.md | 1 - src/Query/Terms.php | 10 ---------- tests/Query/TermsTest.php | 6 ++++-- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4786f595e9..4a7f8a2f81 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Added `AbstractTermsAggregation::setIncludeAsExactMatch()` [#1766](https://github.com/ruflin/Elastica/pull/1766) * Added `AbstractTermsAggregation::setExcludeAsExactMatch()` [#1766](https://github.com/ruflin/Elastica/pull/1766) * Added `AbstractTermsAggregation::setIncludeWithPartitions()` [#1766](https://github.com/ruflin/Elastica/pull/1766) -* Added `Elastica\Query\Terms::buildTermsLookup()` helper to build a terms-lookup query [#1765](https://github.com/ruflin/Elastica/pull/1765) * Added `Elastica\Reindex->setPipeline(Elastica\Pipeline $pipeline): void`. The link between the reindex and the pipeline is solved when `run()` is called, and thus the pipeline given doesn't need to be created before calling `setPipeline()` [#1752](https://github.com/ruflin/Elastica/pull/1752) * Added `Elastica\Reindex->setRefresh(string $value): void`. It accepts `REFRESH_*` constants from its class [#1752](https://github.com/ruflin/Elastica/pull/1752) and [#1758](https://github.com/ruflin/Elastica/pull/1758) * Added `Elastica\Reindex->setQuery(Elastica\Query\AbstractQuery $query): void` [#1752](https://github.com/ruflin/Elastica/pull/1752) diff --git a/src/Query/Terms.php b/src/Query/Terms.php index 9a40698354..924081bc25 100644 --- a/src/Query/Terms.php +++ b/src/Query/Terms.php @@ -42,16 +42,6 @@ public function __construct(string $field, array $terms = []) $this->terms = $terms; } - /** - * Commodity function to build a Terms query, preconfigured for terms lookup. - */ - public static function buildTermsLookup(string $field, string $index, string $id, string $path): self - { - $t = new self($field); - - return $t->setTermsLookup($index, $id, $path); - } - /** * Sets terms for the query. * diff --git a/tests/Query/TermsTest.php b/tests/Query/TermsTest.php index 12f7150586..9d1c980b92 100644 --- a/tests/Query/TermsTest.php +++ b/tests/Query/TermsTest.php @@ -21,7 +21,8 @@ public function testSetTermsLookup(): void 'path' => 'terms', ]; - $query = Terms::buildTermsLookup('name', 'index_name', '1', 'terms'); + $query = new Terms('name'); + $query->setTermsLookup('index_name', '1', 'terms'); $data = $query->toArray(); $this->assertEquals($terms, $data['terms']['name']); @@ -86,7 +87,8 @@ public function testFilteredSearchWithLookup(): void new Document(3, ['name' => 'ruflin']), ]); - $query = Terms::buildTermsLookup('name', $lookupIndex->getName(), '1', 'terms'); + $query = new Terms('name'); + $query->setTermsLookup($lookupIndex->getName(), '1', 'terms'); $index->refresh(); $lookupIndex->refresh();