GraphQL Admin API filter products by tags using partial search

PavelP
New Member
1 0 1

Hello everybody!

I have got an issue with search of products by tags.

Is it possible to use partial search (something like this  products(query: "tag:*Enter*", first: 5, sortKey: TITLE) )?

I did not find any documented solution, but experimentally I have found that the query

{
  products(query: "tag:*(Enter)*", first: 5, sortKey: TITLE) {
    edges {
      node {
        id
        title
        tags
      }
    }
  }
}


returns next result

{
  "data": {
    "products": {
      "edges": [
        {
          "node": {
            "id": "gid://shopify/Product/877660733487",
            "title": "Apple iPhone 7 with 'quotes'",
            "tags": [
              "Entertainment"
            ]
          }
        },
        {
          "node": {
            "id": "gid://shopify/Product/841148301359",
            "title": "Nokia Entertainment",
            "tags": [
              "Excelent",
              "Good"
            ]
          }
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 7,
      "actualQueryCost": 4,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 996,
        "restoreRate": 50
      }
    }
  }
}

Unfortunately the second product does not contain any tag started with "Enter". It looks like filter also applied to the title field.

Does anybody know how can I get partial search by tags correctly?

 

Thank you in advance!

SlavaLabus
New Member
2 0 0

what is heard on this issue?

0 Likes
jdhenckel
Excursionist
11 0 4

why must you put stars in the query?  I think you can just use "tag:Enter" and it will work.  Try that.

0 Likes
PSHIU
Tourist
4 0 1

@PavelP 

Try with

products(query: "tag:'Enter'", first: 5, sortKey: TITLE)

 

0 Likes