Prefix query not supported

Using prefix query in GraphQL doesn’t work in some cases.

Note: I’ve created only 1 collection with the “shirt_” prefix in its title.

Working query(notice using full title):

{
  product(id: "gid://shopify/Product/6180735910073"){
    collections(first: 2, query: "title:shirt_test"){
      edges{
        node{
          id
        }
      }
    }
  }
  collections(first:2, query: "title:shirt_*"){
      edges{
          node{
              id
          }
      }
  }
}

Result(no errors):

{
    "data": {
        "product": {
            "collections": {
                "edges": [
                    {
                        "node": {
                            "id": "gid://shopify/Collection/283961196729"
                        }
                    }
                ]
            }
        },
        "collections": {
            "edges": [
                {
                    "node": {
                        "id": "gid://shopify/Collection/283961196729"
                    }
                }
            ]
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 9,
            "actualQueryCost": 7,
            "throttleStatus": {
                "maximumAvailable": 2000.0,
                "currentlyAvailable": 1993,
                "restoreRate": 100.0
            }
        }
    }
}

Not working(notice using prefix query “shirt_*”):

{
  product(id: "gid://shopify/Product/6180735910073"){
    collections(first: 2, query: "title:shirt_*"){
      edges{
        node{
          id
        }
      }
    }
  }
  collections(first:2, query: "title:shirt_*"){
      edges{
          node{
              id
          }
      }
  }
}

Result(error occurred: Query not supported):

{
    "data": {
        "product": null,
        "collections": {
            "edges": [
                {
                    "node": {
                        "id": "gid://shopify/Collection/283961196729"
                    }
                }
            ]
        }
    },
    "errors": [
        {
            "message": "Query not supported.",
            "locations": [
                {
                    "line": 3,
                    "column": 5
                }
            ],
            "path": [
                "product",
                "collections"
            ]
        }
    ],
    "extensions": {
        "cost": {
            "requestedQueryCost": 9,
            "actualQueryCost": 6,
            "throttleStatus": {
                "maximumAvailable": 2000.0,
                "currentlyAvailable": 1994,
                "restoreRate": 100.0
            }
        }
    }
}

Does anyone encountered this same issue? Any solution?

2 Likes