Query Suggestions | Yext Hitchhikers Platform

Query suggestions help end users by suggesting queries they can select from to “autocomplete” their search. Search leverages three different types of query suggestions: universal prompts, vertical prompts, and popular queries. Check out the Query Suggestions unit for more details.

Search Configuration Schema

Within the Search configuration, the querySuggestions object defines the configuration settings for query suggestions. Refer to the table below for the available fields. View where querySuggestions fits into the configuration in the Search Config Properties - Top Level reference doc.

Property Type Shown in Config UI Description
disablePopularQueries boolean Yes Disables autocomplete prompts from popular queries
verticalPromptsOnEmpty boolean No Control whether or not prompts return for an empty string for all verticals (default to False)
popularQueriesBlacklistedTerms array of objects No Terms that should be blacklisted from popular queries
popularQueriesBlacklistedRegex array of strings No Regex patterns that should be blacklisted from popular queries
universalPrompts array of strings Yes Collection of prompts shown to the user on a universal search
verticalPrompts object Yes Map of vertical key to vertical prompts
verticalPrompts.[[verticalKey]] array of strings Yes Collection of prompts shown to the user on a vertical search for a given vertical key

Top-Level Object

The JSON below is for demonstrative purposes only to show the structure of the querySugestions object through the top-level properties. Find more detail about each property below.

  "querySuggestions": {
    "disablePopularQueries": false,
    "verticalPromptsOnEmpty": false,
    "popularQueriesBlacklistedTerms": [],
    "popularQueriesBlacklistedRegex": [],
    "universalPrompts": [],
    "verticalPrompts": {}
  }

Blacklist specific terms from popular queries by listing each term as an object with the key term in the array popularQueriesBlacklistedTerms.

The following example shows a term with typos (restaurantsnearme is missing two spaces) that you may want to remove from popular queries:

  "querySuggestions": {
    "popularQueriesBlacklistedTerms": [
      {
        "term": "restaurantsnearme" //typo
      }
    ],
  }

Blacklist regular expressions from popular queries by listing each regex as a string in the array popularQueriesBlacklistedRegex.

The following example blacklists any queries that contain bad word or any social security number with the format ###-##-####.

  "querySuggestions": {
    "popularQueriesBlacklistedRegex": [
      ".*bad word.*", 
      "^\d{3}-\d{2}-\d{4}$" // social security numbers
    ],
  }

Universal Prompts

Define universal prompts by listing each prompt as a string in the array universalPrompts.

The following example lists four universal prompts.

  "querySuggestions": {
    "universalPrompts": [
      "Restaurants near me",
      "Do you offer delivery?",
      "Do you sell gift cards?",
      "Where to redeem gift cards"
    ],
  }

Vertical Prompts

Define vertical prompts in the array verticalPrompts. Use vertical keys to map to an array that lists each prompt as a string. Embed fields using double square brackets [[ ]].

The following example lists one vertical prompt for the FAQs vertical and two for the Restaurants vertical.

  "querySuggestions": {
    "verticalPrompts": {
      "faqs": [
        "[[name]]"
      ],
      "restaurants": [
        "Restaurants near me",
        "Restaurants in [[address.city]]"
      ]
    }
  }

Query Suggestions Behavior

  • Queries are only considered if they are from the Production configuration label, not Staging.
  • Shows in descending order of # of sessions
  • The order is not customizable
  • Query string must have at least two or more sessions
  • Query must be 75 characters or less
  • Number of searches for that query must be greater than the average number of searches for any query (for that experience)
  • Will not include any blacklisted terms (vulgar words or profanity)
  • In an empty query state, only prompts without embedded fields will appear when a user clicks into the search bar.
  • As a user starts typing, prompts (including those with embedded fields) and popular queries will both appear in the order of popularity. If a prompt has never been used before, it will be last in the list.
  • You’ll need to wait for the site to be re-indexed before this update will take place, but reindexing happens on a nightly basis.