Skip to content
Snippets Groups Projects
Commit 875f9260 authored by davidwhthomas's avatar davidwhthomas Committed by Jonathan Sacksick
Browse files

Issue #3431628: Sort facets by weight in JSON:API response

parent e06de361
No related branches found
No related tags found
1 merge request!12Issue #3431628: Sort facets by weight in JSON:API response
Pipeline #303043 passed
......@@ -62,6 +62,10 @@ class AddSearchMetaEventSubscriber implements EventSubscriberInterface {
'!index' => $query->getIndex()->id(),
]);
$facets = $this->facetManager->getFacetsByFacetSourceId($facet_source_id);
// Sort facets by configured weight order.
usort($facets, function ($facet1, $facet2) {
return $facet1->getWeight() <=> $facet2->getWeight();
});
$meta = [];
foreach ($facets as $facet) {
// No need to build the facet if it does not need to be visible.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment