GraphQL return wrong result when searching part of SKU

aldoalprak
Shopify Partner
15 1 0

Hi All, need some enlightenment for the graphQL query to search partial SKU. So I want to search the SKU start with "998-" (sku:998-123) but turns out the SKU that ends with "998" (sku:12-998) also appeared. Below is the query

 {
  products(first: 10,query:"sku:998-*") {
    pageInfo{
      hasNextPage
    }
    edges{
      node{
        title
      }
    }
  }
}  

 

Also, the other strange result is when I query the SKU that is equal to "ZAP-123", the product that has SKU equal to "12-ZAP" also appeared. This makes me confused.

{
  products(first: 10,query:"sku:ZAP-123") {
    pageInfo{
      hasNextPage
    }
    edges{
      node{
        title
      }
    }
  }
} 

 

For now, my hypothesis is the dash ("-") char might be the culprit. But not sure. 

 

0 Likes
aldoalprak
Shopify Partner
15 1 0

Hi @SBD_, maybe you can help? 

0 Likes