younifyd
Menu

predictiveSearch

Search-as-you-type results across products, collections, pages, articles and queries from a partial term.

Use it in a workflow

  1. Add a step and choose the Shopify Storefront connector.
  2. Pick the predictiveSearch action (under Predictive).
  3. Fill in the fields below, then reference the result from later steps as {{predictivesearch.response.data}}.

Query

This is the query the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
query PredictiveSearch($limit: Int, $limitScope: PredictiveSearchLimitScope, $query: String!, $searchableFields: [SearchableField!], $types: [PredictiveSearchType!], $unavailableProducts: SearchUnavailableProductsType) {
  predictiveSearch(
    limit: $limit
    limitScope: $limitScope
    query: $query
    searchableFields: $searchableFields
    types: $types
    unavailableProducts: $unavailableProducts
  ) {
    articles {
      author {
        bio
        email
        firstName
        lastName
        name
      }
      authorV2 {
        bio
        email
        firstName
        lastName
        name
      }
      blog {
        authors
        handle
        id
        onlineStoreUrl
        seo
        title
      }
      contentHtml
      excerptHtml
      handle
      id
      image {
        altText
        height
        id
        originalSrc
        src
        thumbhash
        width
      }
      onlineStoreUrl
      publishedAt
      seo {
        description
        title
      }
      tags
      title
      trackingParameters
    }
    collections {
      descriptionHtml
      handle
      id
      image {
        altText
        height
        id
        originalSrc
        src
        thumbhash
        width
      }
      onlineStoreUrl
      seo {
        description
        title
      }
      title
      trackingParameters
      updatedAt
    }
    pages {
      body
      bodySummary
      createdAt
      handle
      id
      onlineStoreUrl
      seo {
        description
        title
      }
      title
      trackingParameters
      updatedAt
    }
    products {
      availableForSale
      category {
        ancestors
        id
        name
      }
      compareAtPriceRange {
        maxVariantPrice
        minVariantPrice
      }
      createdAt
      descriptionHtml
      encodedVariantAvailability
      encodedVariantExistence
      featuredImage {
        altText
        height
        id
        originalSrc
        src
        thumbhash
        width
      }
      handle
      id
      isGiftCard
      onlineStoreUrl
      priceRange {
        maxVariantPrice
        minVariantPrice
      }
      productType
      publishedAt
      requiresSellingPlan
      seo {
        description
        title
      }
      tags
      title
      totalInventory
      trackingParameters
      updatedAt
      variantsCount {
        count
        precision
      }
      vendor
    }
    queries {
      styledText
      text
      trackingParameters
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

limitnumber

Limits the number of results based on `limit_scope`. The value can range from 1 to 10, and the default is 10.

limitScopestring

Decides the distribution of results.

One ofALLEACH

querystringrequired

The search query.

searchableFieldsarray<string>

Specifies the list of resource fields to use for search. The default fields searched on are TITLE, PRODUCT_TYPE, VARIANT_TITLE, and VENDOR. For the best search experience, you should search on the default field set. The input must not contain more than `250` values.

typesarray<string>

The types of resources to search for. The input must not contain more than `250` values.

unavailableProductsstring

Specifies how unavailable products are displayed in the search results.

One ofSHOWHIDELAST

json
{
  "query": "string",
  "limit": 0,
  "limitScope": "ALL",
  "searchableFields": [
    "AUTHOR"
  ],
  "types": [
    "COLLECTION"
  ],
  "unavailableProducts": "SHOW"
}

Response

Read the result with {{predictivesearch.response.data.data.predictiveSearch}}. If the API returns errors, the step fails and they are at {{predictivesearch.response.data.errors}}.

articlesarray<object>
authorobject
authorV2object
blogobject
contentHtmlobject
excerptHtmlobject
handleobject
idobject
imageobject
onlineStoreUrlobject
publishedAtobject
seoobject
tagsobject
titleobject
trackingParametersobject
collectionsarray<object>
descriptionHtmlobject
handleobject
idobject
imageobject
onlineStoreUrlobject
seoobject
titleobject
trackingParametersobject
updatedAtobject
pagesarray<object>
bodyobject
bodySummaryobject
createdAtobject
handleobject
idobject
onlineStoreUrlobject
seoobject
titleobject
trackingParametersobject
updatedAtobject
productsarray<object>
availableForSaleobject
categoryobject
compareAtPriceRangeobject
createdAtobject
descriptionHtmlobject
encodedVariantAvailabilityobject
encodedVariantExistenceobject
featuredImageobject
handleobject
idobject
isGiftCardobject
onlineStoreUrlobject
priceRangeobject
productTypeobject
publishedAtobject
requiresSellingPlanobject
seoobject
tagsobject
titleobject
totalInventoryobject
trackingParametersobject
updatedAtobject
variantsCountobject
vendorobject
queriesarray<object>
styledTextobject
textobject
trackingParametersobject

Need more? See the Shopify Storefront guide for connection setup and behaviour shared by every action.

Was this page helpful?