Skip to content

Category or Brand Pages as Phrase Suggestions in Autocomplete

Overview

When a visitor interacts with the search assistant (autocomplete), they may expect to see suggestions for category pages or brand pages. By default, Elevate does not return category or brand pages as part of the suggestions in the autocomplete. This guide explains a workaround to allow category or brand pages suggestions to be part of the phrase suggestions in the autocomplete response.

Step-by-step Implementation

Step 1. Index Category Page References

To make category suggestions available in autocomplete, category or brand pages must be indexed as content.
Below is an example of how to add category and brand pages as content in the data feed:

{"replace":{"key":"c1","content":{"markets":["uk"],"type":"category","defaults":{"title":"Dresses","url":"/dresses"}}}}
{"replace":{"key":"b2","content":{"markets":["uk"],"type":"brand","defaults":{"title":"Acme Co.","url":"/acme-co"}}}}

Step 2. Querying Autocomplete with Category Suggestions

Once categories are indexed, content must be requested using a POST method when calling the autocomplete endpoint/method.

Example

//request-body.json
{
 "contentLists": [
    {
        "id": "category-suggestions",
        "contentFilter": {
            "type": ["category"]
        }
    },
    {
        "id": "brand-suggestions",
        "contentFilter": {
            "type": ["brand"]
        }
    }
]
}
#!/bin/bash
curl -X POST \
"https://{{cluster-id}}.elevate-api.cloud/api/storefront/v3/queries/autocomplete?market=US&locale=en-US&sessionKey=4b116e34-0a7a-ce5d-5591-75c62f231967&customerKey=4b116e34-0a7a-ce5d-5591-75c62f231967&touchpoint=DESKTOP&q=acme" \
-H 'Content-Type: application/json' \
-d @request-body.json

const api = esales({
clusterId: "cluster-id",
market: "uk",
locale: "en-GB",
touchpoint: "desktop",
session: () => ({
    customerKey: "0b05119e-eeb8-418a-bbfb-defa0dde417",
    sessionKey: "0b05119e-eeb8-418a-bbfb-defa0dde417"
})
});

const results = await api.query.autocomplete(
{ q: "acme" },
{
"contentLists": [
  {
    "id": "category-suggestions",
    "contentFilter": { "type": ["category"] }
  },
  {
    "id": "brand-suggestions",
    "contentFilter": { "type": ["brand"] }
  }
 ]
}
);

The "type" value must match the one used in the data feed.

Behavior and Limitations

  • Empty pages, i.e., pages that contains no product listing, will still appear as suggestions in autocomplete responses.
  • Elevate treats these as generic content, without awareness of connections to actual category pages.

Best Practices and Summary

  • Use meaningful words like "category" or "brand" as the type value for clarity.
  • Add keywords to maximize discoverability.
  • Test the autocomplete queries to ensure that the correct categories appear, and the visitors get redirected to the correct category or brand page.
×
Copyright

This online publication is intellectual property of Voyado Lund AB. Its contents can be duplicated in part or whole, provided that a copyright label is visibly located on each copy and the copy is used in conjunction with the product described within this document.

All information found in these documents has been compiled with utmost attention to detail. However, this does not guarantee complete accuracy. Neither Voyado Lund AB nor the authors shall be held liable for possible errors or the consequences thereof.

Software and hardware descriptions cited in these documents might be registered trademarks. All trade names are subject to copyright restrictions and may be registered trademarks. Voyado Lund AB essentially adheres to the manufacturer’s spelling. Names of products and trademarks appearing in this document, with or without specific notation, are likewise subject to trademark and trade protection laws and may thus fall under copyright restrictions.

CLOSE