mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-23 12:16:09 +01:00
TASK: Refactor code into common flow
As we have the same flow in some more places, we refactor this part to follow this conventions.
This commit is contained in:
parent
a858d748ee
commit
564ca1511c
1 changed files with 11 additions and 8 deletions
|
@ -121,14 +121,17 @@ class SearchResult implements SearchResultInterface
|
|||
}
|
||||
|
||||
$this->facets = [];
|
||||
if ($this->result->hasAggregations()) {
|
||||
foreach ($this->result->getAggregations() as $aggregationName => $aggregation) {
|
||||
$this->facets[$aggregationName] = $this->objectManager->get(
|
||||
Facet::class,
|
||||
$aggregationName,
|
||||
$aggregation
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->result->hasAggregations() === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->result->getAggregations() as $aggregationName => $aggregation) {
|
||||
$this->facets[$aggregationName] = $this->objectManager->get(
|
||||
Facet::class,
|
||||
$aggregationName,
|
||||
$aggregation
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue