Autosuggest Categories

If an autosuggest query includes categories, then the response includes an attributeSuggestions array. This array helps your site visitors to filter their search results according to categories, and contains objects of:

  • value and attributeType: Form the filtered search API request when a site visitor clicks a suggestion.
  • name: Display text for the suggested category.

Example response

"suggestionGroups": [
  {
    "catalogName": "products",
    "view": "store1",
    "querySuggestions": [
      {
          "query": "atlas",
          "displayText": "atlas"
      }
    ],
    "attributeSuggestions": [ {            
              "value": "mountain_bars",
              "name": "mountain_bars",
              "attributeType": "category"
          },
          {            
              "value": "cranksets",
              "name": "cranksets",
              "attributeType": "category"
          },
    ]
  }
]

What if my API response does not contain category suggestions?

Normally, your suggestion API responses include both suggested queries and suggested categories. Rarely, you might see only query suggestions returned, such as when the prefix isn't in the cache. As soon as a prefix is encountered, a cache entry is created, and both query and category suggestions are returned in responses. In the meantime, you need to make sure that your integration supports displaying only query suggestions.

Your Bloomreach representative can help you if you need more information.