Problem/Motivation
The Drupal facets UI allows configuring the facet weight.
However, the JSON:API facet ordering is default alphabetically.
The current API response contains no weight information to allow presenting facets in the frontend according to the configured weight order.
Steps to reproduce
Check the Search API response with facets, e.g /jsonapi/index/index_name?filter[fulltext]=keyword
Proposed resolution
Sort the facets by weight when adding the `meta` facet data.
Remaining tasks
Patch incoming
User interface changes
No user interface changes
API changes
Facet data is the same but the array order respects the configured weight from the Drupal facet UI configuration.
Data model changes
No data model changes.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Screen Shot 2024-03-19 at 11.18.40 AM.png | 320.93 KB | davidwhthomas |
| #3 | Screen Shot 2024-03-19 at 11.14.46 AM.png | 783.97 KB | davidwhthomas |
Issue fork jsonapi_search_api-3431628
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
davidwhthomas commentedAdding some screenshots to illustrate, with thanks for the useful module!
Comment #4
davidwhthomas commentedComment #7
jsacksick commentedThank you for this, merged!