Skip to content

Commit

Permalink
Remove children count aggregation for element search
Browse files Browse the repository at this point in the history
  • Loading branch information
markus-moser committed May 24, 2024
1 parent 17f2a50 commit 0fd0486
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 2 additions & 0 deletions doc/04_Searching_For_Data_In_Index/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public function searchAction(SearchProviderInterface $searchProvider, DocumentSe

The element search service can be used to search for assets, data objects and documents at the same time.

**Hint:** the element search does not support the calculation of the `hasChildren` attributes. This means that the `hasChildren` attribute will always be `false` for all elements.

- Example: This example loads all elements and orders them by their full path.
```php
use Pimcore\Bundle\GenericDataIndexBundle\Service\Search\SearchService\SearchProviderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,11 @@ public function search(SearchInterface $elementSearch): ElementSearchResult
indexName: $this->globalIndexAliasService->getElementSearchAliasName()
);

$childrenCounts = $this->searchHelper->getChildrenCounts(
searchResult: $searchResult,
indexName: $this->globalIndexAliasService->getElementSearchAliasName(),
search: $this->searchProvider->createElementSearch()
);

try {
return new ElementSearchResult(
items: $this->searchHelper->hydrateSearchResultHits(
$searchResult,
$childrenCounts,
[],
$elementSearch->getUser()
),
pagination: $this->paginationInfoService->getPaginationInfoFromSearchResult(
Expand Down

0 comments on commit 0fd0486

Please sign in to comment.