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.

Command icon 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

davidwhthomas created an issue. See original summary.

davidwhthomas’s picture

Status: Active » Needs review
StatusFileSize
new783.97 KB
new368.02 KB

Adding some screenshots to illustrate, with thanks for the useful module!

davidwhthomas’s picture

StatusFileSize
new320.93 KB

jsacksick made their first commit to this issue’s fork.

jsacksick’s picture

Status: Needs review » Fixed

Thank you for this, merged!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.