Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsonapi_search_api
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
jsonapi_search_api
Commits
875f9260
Commit
875f9260
authored
4 months ago
by
davidwhthomas
Committed by
Jonathan Sacksick
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3431628
: Sort facets by weight in JSON:API response
parent
e06de361
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!12
Issue #3431628: Sort facets by weight in JSON:API response
Pipeline
#303043
passed
4 months ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/jsonapi_search_api_facets/src/EventSubscriber/AddSearchMetaEventSubscriber.php
+4
-0
4 additions, 0 deletions
...cets/src/EventSubscriber/AddSearchMetaEventSubscriber.php
with
4 additions
and
0 deletions
modules/jsonapi_search_api_facets/src/EventSubscriber/AddSearchMetaEventSubscriber.php
+
4
−
0
View file @
875f9260
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment