Sorting nodes by title aren't returned in correct order.

Created on 6 December 2020, about 4 years ago
Updated 27 February 2023, almost 2 years ago

Problem/Motivation

I've been playing around this the JSON:API module in D9 using the Umami Profile to have some content to query against. I noticed that when sorting by title on node queries they are not being returned in the correct alphabetical order (at least as I understand it).

For instance: /jsonapi/node/recipe?sort=title returns the list of recipes in the following order:

  1. Vegan chocolate and nut brownies
  2. Crema catalana
  3. Thai green curry
  4. Deep mediterranean quiche
  5. Fiery chili sauce
  6. Gluten free pizza
  7. Super easy vegetarian pasta bake
  8. Victoria sponge cake
  9. Watercress soup


Actually the reverse order is off as well. "Deep mediterranean quiche" should be above "Crema catalana" and "Gluten free pizza" should be above "Fiery chili sauce"

  1. Watercress soup
  2. Victoria sponge cake
  3. Vegan chocolate and nut brownies
  4. Thai green curry
  5. Super easy vegetarian pasta bake
  6. Fiery chili sauce
  7. Deep mediterranean quiche
  8. Gluten free pizza
  9. Crema catalana

the same thing appears to be happening on other content types such as articles: /jsonapi/node/article?sort=title

I'm using Umami as an example but I assume there is nothing particular about the Umami profile that is causing the issue.

Steps to reproduce

  1. Install Drupal 9 with the Umami Profile.
  2. Enable the JSON:API module and any associated modules.
  3. Got to the url: /jsonapi/node/recipe?sort=title

Expected Order:

  1. Crema catalana
  2. Deep mediterranean quiche
  3. Fiery chili sauce
  4. Gluten free pizza
  5. Super easy vegetarian pasta bake
  6. Thai green curry
  7. Vegan chocolate and nut brownies
  8. Victoria sponge cake
  9. Watercress soup

Actual Order:

  1. Vegan chocolate and nut brownies
  2. Crema catalana
  3. Thai green curry
  4. Deep mediterranean quiche
  5. Fiery chili sauce
  6. Gluten free pizza
  7. Super easy vegetarian pasta bake
  8. Victoria sponge cake
  9. Watercress soup

Proposed resolution

Unknown

Remaining tasks

Unknown

User interface changes

Unknown

API changes

Unknown

Data model changes

Unknown

🐛 Bug report
Status

Needs work

Version

10.1

Component
JSON API 

Last updated 6 days ago

Created by

🇺🇸United States pcate

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024