Warm tip: This article is reproduced from serverfault.com, please click

其他-Shopify GraphQL查询过滤器上的部分匹配

(其他 - Shopify GraphQL partial matching on query filter)

发布于 2018-08-08 08:48:33

我刚刚开始使用新的Shopify GraphQL Admin API我正在尝试检索所有产品,其中该title字段包含某个单词。

目前,我可以通过添加完整的产品标题(完全匹配)来成功检索产品:

{
  shop {
    id
    name
  }
  products(first: 10, query:"title:'RAVEN DUSTY OLIVE/SILVER MESH'") {
    edges {
      node {
        productType
        title
      }
    }
  }
}

但是,我想部分匹配标题以在标题中的任何位置显示所有带有“ Raven”字样的产品,但以下内容不返回任何结果:

{
  shop {
    id
    name
  }
  products(first: 10, query:"title:'RAVEN'") {
    edges {
      node {
        productType
        title
      }
    }
  }
}

关于如何使部分匹配有效的任何想法?

Questioner
Bjorn Forsberg
Viewed
0
Ryan Ormsby 2018-08-13 23:14:39

比约恩!这应该工作:

{
  shop {
    id
    name
  }
  products(first: 10, query:"title:RAVEN*") {
    edges {
      node {
        productType
        title
      }
    }
  }
}

查看文档:https : //help.shopify.com/en/api/getting-started/search-syntax