Search Query containing term not working

Search Query containing term not working

danielr94
Shopify Partner
1 0 1

Hey guys,

 

so what i want to do is querying the products title with a search term and i expect to get all products containing the term somewhere in the title to be returned. 

 

For example in the graphql explorer we have this product title: "3/4 SLEEVE CREWNECK PULLOVER"

I want this to be returned with the following query: 

{
  products(first: 250, query:"title:neck") {
    edges {
      node {
        title
      }
    }
  }
}

 

From the docs i can't figure out a way. I also read in this forum that there's only exact matching, so i won't get the product if the title only contains the term somewhere between, but there was a time when this worked. Is that right?

 

Any help is appreciated! 

 

Cheers

Reply 1 (1)

hugoShop
Shopify Partner
4 1 2

Hi Daniel,

 

Check out the docs here: https://shopify.dev/api/usage/search-syntax

Take a look at Prefix query. This query should do what you are looking for:

{
  products(first: 250, query:"title:*neck*") {
    edges {
      node {
        title
      }
    }
  }
}

 

Cheers