Skip to content

Commit

Permalink
Removed helper function Terms::buildTermsLookup() (#1767)
Browse files Browse the repository at this point in the history
  • Loading branch information
thePanz authored Mar 23, 2020
1 parent 80157d7 commit a5a981c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions src/Query/Terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
6 changes: 4 additions & 2 deletions tests/Query/TermsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit a5a981c

Please sign in to comment.