Broken Admin GraphQL Search

souravchandra
Tourist
19 0 1

Hi,

 

I am currently testing my development store and private app. I am trying out Admin GraphQL API to search among my store products. Though in couple of forum topics its mentioned it supports partial search using "query:title:*xxx*" format by wrapping the string around **. But it does not seem to work. As per search syntax documentation it has only prefix search. 

 

I would like to know is partial search not supported? If it is supported how can i do that?

 

Thanks,

Sourav

Replies 4 (4)
HunkyBill
Shopify Expert
4843 60 546

Query search on title does work. I just tested it, and for all the keywords I tried, I got nice results.

 

{ products(first: 20, query:"title:*dark*") {
  pageInfo {
    hasNextPage
  }
  edges {
    node {
      ... on Product {
        id
        title
        vendor
        productType
        
      }
    }
  }
} 
}

Gave me the products with "dark" in the title.

 

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
souravchandra
Tourist
19 0 1

I have created 2 test products

  • Sourav test 1
  • Sourav test 2

If I use

{ products(first: 20, query:"title:test*") {
  pageInfo {
    hasNextPage
  }
  edges {

node { ... on Product { id title vendor productType } } } } }

it returns fine

 

but if I do

{
  products(first: 20, query: "title:*est*") {
    pageInfo {
      hasNextPage
    }
    edges {
      node {
        ... on Product {
          id
          title
          vendor
          productType
        }
      }
    }
  }
}

it does not return anything

HunkyBill
Shopify Expert
4843 60 546

Yup.

 

Well, you know, real soon now, likely in 2020, Shopify will probably turn on an internal search engine that will allow your style of query. In the meantime, try their search endpoint, and use it as a substitute. It'll give you lots of results. You may not like that either. No one said precision was easy.

 

 

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
souravchandra
Tourist
19 0 1
Could you please point me to the search api link?

Thanks!