Skip to content

Commit

Permalink
Merge pull request #120 from ConductionNL/feature/AXCVDWOF-22/search
Browse files Browse the repository at this point in the history
Facets now also support search
  • Loading branch information
rjzondervan authored Oct 21, 2024
2 parents c0fac5e + ddfa053 commit bd9b174
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/Service/ObjectService.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,15 @@ public function getObjects(
public function getFacets(
string $objectType,
array $filters = [],
?string $search = null
): array
{
// Get the appropriate mapper for the object type
$mapper = $this->getMapper($objectType);

// 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 [];
Expand Down Expand Up @@ -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 [
Expand Down

0 comments on commit bd9b174

Please sign in to comment.