diff --git a/doc/04_Searching_For_Data_In_Index/README.md b/doc/04_Searching_For_Data_In_Index/README.md index 4e9a6a9b..2ba4d486 100644 --- a/doc/04_Searching_For_Data_In_Index/README.md +++ b/doc/04_Searching_For_Data_In_Index/README.md @@ -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; diff --git a/src/Service/Search/SearchService/Element/ElementSearchService.php b/src/Service/Search/SearchService/Element/ElementSearchService.php index 4904a6dc..48ec295a 100644 --- a/src/Service/Search/SearchService/Element/ElementSearchService.php +++ b/src/Service/Search/SearchService/Element/ElementSearchService.php @@ -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(