Admin GraphQL API - pagination not working when using sortKey RELEVANCE

Shopify Partner
34 1 31

Trying to query products and sorting them using the RELEVANCE sortKey results in inconsistent results when paginating.



query ($limit: Int!, $searchQuery: String!, $cursor: String) {
products(query: $searchQuery, sortKey: RELEVANCE first: $limit, after: $cursor) {
edges {
node {
pageInfo {


I know that for a specific query I should have 21 results:

searchQuery = "blue AND status:active AND published_status:published"

Running the above query with limit=20 & cursor=null will result in 20 results but when using cursor of result #20 to get next page, we sometimes get the remaining 1, sometimes get an empty edges array, and sometimes get the first 20 results!

Only once in every 4-5 requests do we get the correct next page.

If using  the default sortKey (by ID) or using CREATED_AT everything works consistently fine.


If using RELEVANCE, results are unexpected. tried both API ver 2021-10 and 2022-01

Anyone have any clue about this issue?



Replies 0 (0)