From ddfa053c7aded0a2368e4ad16f78c126202ee9dc Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Mon, 21 Oct 2024 14:03:49 +0200 Subject: [PATCH] Facets now also support search --- lib/Service/ObjectService.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Service/ObjectService.php b/lib/Service/ObjectService.php index 9cc1d9ca..6242bc56 100644 --- a/lib/Service/ObjectService.php +++ b/lib/Service/ObjectService.php @@ -208,6 +208,7 @@ public function getObjects( public function getFacets( string $objectType, array $filters = [], + ?string $search = null ): array { // Get the appropriate mapper for the object type @@ -215,7 +216,7 @@ public function getFacets( // Use the mapper to find and return the objects based on the provided parameters if ($mapper instanceof \OCA\OpenRegister\Service\ObjectService === true) { - return $mapper->getAggregations($filters); + return $mapper->getAggregations(filters: $filters, search: $search); } return []; @@ -406,7 +407,11 @@ public function getResultArrayForRequest(string $objectType, array $requestParam extend: $extend, search: $search ); - $facets = $this->getFacets($objectType, $filters); + $facets = $this->getFacets( + objectType: $objectType, + filters: $filters, + search: $search + ); // Prepare response data return [