MDVA-40120: GraphQL sorting by DESC/ASC doesn't work with products having the same relevance or price
GraphQL sorting by DESC/ASC doesn't work with products having the same relevance or price. Quality patch MDVA-40120 for magento/module-catalog-graph-ql applies to Magento Open Source and Adobe Commerce 2.4.1 to 2.4.3-p3.
- Categories
- Catalog/Product, GraphQL
- Components
- magento/module-catalog-graph-ql
- Origin
- adobe-commerce-support
- Since QPT
- 1.1.6
Issue
Fixes the issue where GraphQL sorting by DESC/ASC doesn't work with products having the same relevance or price.
Steps to reproduce
1. Run the following GraphQL query: { products(filter: {category_id: {eq: "{{cat_id}}"}}, sort: {relevance: ASC}) { total_count items { name sku } } } 1. Check the response. 1. Change the sort order from ASC to DESC in the GraphQL query: { products(filter: {category_id: {eq: "{{cat_id}}"}}, sort: {relevance: DESC}) { total_count items { name sku } } } 1. Check the response.
Adobe's page lists 2.4.1 - 2.4.3-p1 as compatible; the versions below are resolved from the current QPT constraints and are the ones the tool will offer.
Adobe scheduled the permanent fix for 2.4.4.
Install
Install the Quality Patches Tool with composer require magento/quality-patches, apply the prerequisites listed for all files applicable to your distribution and version first, then run vendor/bin/magento-patches apply MDVA-40120. On Cloud, add MDVA-40120 under stage.build.QUALITY_PATCHES in .magento.env.yaml.
For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its MDVA-40120/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Bundle prerequisites the same way and list them first. Paths are relative to each package root, using the default -p1 level. Prefer local files when configuring composer-patches; a remote URL can change.
Patch files and compatible versions
magento/magento2-base >=2.4.1 <2.4.4
- Patch file
- patches/os/MDVA-40120_2.4.2-p1.patch
- vendor/magento/module-catalog-graph-ql/DataProvider/Product/SearchCriteriaBuilder.php
