Sort facets by weight in JSON:API response

Created on 18 March 2024, 9 months ago

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.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇳🇿New Zealand davidwhthomas

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024