Autocomplete/SAYT
SAYT configuration options.
Property | Type | Default |
---|---|---|
area |
string | area in top-level configuration |
collection |
string | collection in top-level configuration |
category |
string | |
hoverAutoFill |
boolean | true |
language |
string | language in top-level configuration |
suggestionCount |
number | 5 |
navigationCount |
number | 5 |
navigations |
{ [key: string]: string } | |
products |
object | |
recommendations |
object | |
overrides |
object | |
searchCharMinLimit |
number | 1 |
area
The SAYT area to use for your records using the SAYT endpoint.
collection
The SAYT collection to use for your records using the SAYT endpoint.
category
The category to return for the top suggested term.
language
The language to use in the autocomplete request (only meaningful if it’s not English, and the upload configuration has defined that the content is not English).
hoverAutoFill
When enabled, hovering over SAYT keyword suggestions will update the query shown within the search box. (The suggested products will be updated off the hovered query regardless of this setting).
suggestionCount
The number of keywords to request from the Search API SAYT endpoint. Typically this will be the final number shown, unless custom filtering is created.
navigationCount
The number of navigations to request from the Search API SAYT endpoint. Typically this will be the final number shown, unless custom filtering is created.
navigations
SAYT does not inherit any labels for Navigations. In this section you can label the navigation fields returned in SAYT. The section expects an object with key-value pairs, where the key
is the navigation field, and the value
is the intended label. If you’re showing navigation suggestions for autocomplete, this section must be defined.
For example, { 'category1': 'Departments' }
would set the navigation field category1
to the label Departments
.
This does not determine which navigations are returned in SAYT. That is handled by your upload SAYT config
products
Product-specific autocomplete settings. In this section you define the settings used for the Products panel within autocomplete, if these are different from the primary autocomplete configuration.
Property | Type | Default |
---|---|---|
area |
string | area in top-level or autocomplete-specific configuration |
collection |
string | collection in top-level or autocomplete-specific configuration |
language |
string | language in top-level or autocomplete-specific configuration |
count |
number | 4 |
area
The area used with the Search endpoint for the products call. If you define a different area here, you’ll also need to define it in the overrides below to ensure the suggestions + products match up.
collection
The product collection used with the Search endpoint for the products call. If you define a different collection here, you’ll also need to define it in the overrides below to ensure the suggestions + products match up.
language
The language to use for the products in autocomplete. (Only meaningful if the language is not English, and additional languages were defined in the upload configuration).
count
The number of products to show in the products panel.
recommendations
Recommendations-specific autocomplete settings. The recommendations (keyword suggestions driven by the Recommendations API) are a separate call from the primary keywords, and are shown in their own tag and section of the SAYT component.
Property | Type | Default |
---|---|---|
suggestionCount |
number | 2 |
suggestionMode |
string | 'popular' |
suggestionCount
The number of keywords to request from the Recommendations API.
suggestionMode
What kind of Recommendations call to make for the keywords. Options are 'popular'
, 'trending'
and 'recent'
.
overrides
The SAYT component makes 2 API calls:
suggestions
calls the SAYT API and powers keywords and navigations suggestedproducts
calls the Search API and powers the products that are shown for a given keyword or navigation.
Note: SAYT Product endpoint is deprecated.
These overrides let us add additional configuration to these calls.
Property | Type |
---|---|
suggestions |
object |
products |
object |
suggestions
The overrides to use for your autocomplete suggestions to the SAYT endpoint. Please refer to SAYT API for what parameters you can pass in here.
For example, we can override the collection used for the keywords:
autocomplete: {
overrides: {
suggestions: {
collection: 'production'
}
}
}
Note that area
should not be passed in suggestions
as SAYT API does not accept area
as a parameter.
You can also use a function that returns an object to set the overrides:
autocomplete: {
overrides: {
suggestions: (config) => {
// do stuff
return { collection: 'production' };
}
}
}
products
The overrides to use for your autocomplete products to the SEARCH endpoint. Please refer to SEARCH API for what parameters you can pass in here.
For example, you can override which collection is used for the Products API call:
autocomplete: {
overrides: {
products: {
collection: 'saytCollectionToUse',
refinements: [{type: "Value", navigationName: "Example_Name", exclude: true, value: "Example"}]
}
}
}
… or you can use a function that returns an object:
(Note that when you use a function within the autocomplete override, you must add the ...config
as shown below).
autocomplete: {
overrides: {
products: (config) => {
// do stuff
return {
...config,
collection: 'saytCollectionToUse',
refinements: [{type: "Value", navigationName: "Example_Name", exclude: true, value: "Example"}]
};
},
}
}
searchCharMinLimit
The minimum number of characters that must be in the search box before SAYT activates.