Preparing SPARQUE Desk for Populating Suggestions

The /suggestions endpoint of the Wrapper is intended for populating an autocomplete dropdown in a search bar. Given its purpose, it is best to keep the strategies simple and efficient. There are five types of suggestions available:

  • products
  • keywords
  • categories
  • content
  • brands

Each suggestion can be enabled or disabled individually through SPARQUE Hub, see Settings Through SPARQUE Hub for details.

Endpoint productsuggest

The productsuggest endpoint is used by the Wrapper endpoint /suggestions to provide product suggestions that match a specific keyword. It requires the parameter keyword (string), and can optionally accept channel and locale parameters, both of which are of type string.

This endpoint is designed to return product objects [OBJ]. Each product should have a least an identifier (defined within the result description).

productsuggest/p/locale/{STRING}/p/keyword/{STRING}/p/channel/{STRING} -> OBJ

Endpoint keywordsuggest

The keywordsuggest endpoint is utilized by the Wrapper endpoint /suggestions to provide keyword suggestions. It requires the keyword (string) and locale (string) parameters, and can optionally accept a channel (string) parameter.

This endpoint is designed to return keyword strings. There is no need to consider API result descriptions, as the output consists solely of strings.

keywordsuggest/p/locale/{STRING}/p/keyword/{STRING}/p/channel/{STRING} -> OBJ

Endpoint categorysuggest

The categorysuggest endpoint is utilized by the Wrapper endpoint /suggestions to provide category suggestions. It requires the parameters keyword (string) and locale (string), and can optionally accept a channel (string) parameter.

categorysuggest/p/locale/{STRING}/p/keyword/{STRING}/p/channel/{STRING} -> OBJ

This endpoint is designed to return category objects [OBJ]. Each product should have at least an identifier (defined within the result description).

Additionally, you can choose to include parent categories in the response by adjusting the result description. This allows categories to be displayed with root levels within the search bar. For example, when someone is searching for volksw, you can show the category suggestion as {{volkswagen in cars}}.

{
   "class": "https://www.sparque.ai/category",
   "level": 2,
   "mode": "full",
   "attributes": [
      {
         "name": "description",
         "type": "STRING",
         "aggr": "most_frequent"
      },
      {
         "name": "identifier",
         "type": "STRING",
         "aggr": "most_frequent",
         "splitLanguages": true
      },
      {
         "name": "image",
         "type": "STRING",
         "aggr": "most_frequent",
         "splitLanguages": true
      },
      {
         "name": "name",
         "type": "STRING",
         "aggr": "most_frequent"
      },
      {
         "name": "online",
         "type": "INTEGER",
         "aggr": "most_frequent"
      },
      {
         "name": "root",
         "type": "INTEGER",
         "aggr": "most_frequent"
      }
   ],
   "constants": [],
   "includes": [
      {
         "class": [
            "https://www.sparque.ai/category"
         ],
         "cardinality": "*",
         "level": 3,
         "prefix": "hasParent",
         "dense": false,
         "predicate": "hasParent",
         "reverse": false
      }
   ]
},
[...]

Endpoint contentsuggest

The contentsuggest endpoint is used by the Wrapper endpoint /suggestions to provide content suggestions. It requires the parameter keyword (string), and can optionally accept channel and locale parameters, both of which are of type string.

This endpoint is designed to return content objects [OBJ].

contentsuggest/p/locale/{STRING}/p/keyword/{STRING}/p/channel/{STRING} -> OBJ

Endpoint brandsuggest

The brandsuggest endpoint is used by the Wrapper endpoint /suggestions to provide brand suggestions that match a specific keyword. It requires the parameter keyword (string), and can optionally accept a channel (string) parameter.

This endpoint is designed to return brand names. There is no need to consider API result descriptions, as the output consists solely of strings.

brandsuggest/p/keyword/{STRING}/p/channel/{STRING} -> OBJ

Suggestions and Search Personalization

When search personalization is enabled, the Wrapper will call the endpoints user_categorysuggest and user_keywordsuggest instead of categorysuggest and keywordsuggest, see User and Channel Specific Catalogs for details.