The Autosuggest feature provides query suggestions which delivers faster results to your visitors on your site. Unbxd supports autocompleting search queries and showcasing products relevant to query as they type. Usually, this feature comes in-built with the Unbxd Search, but you can also implement Unbxd Autosuggest as a standalone feature in your site. With Autosuggest, your visitors can search their intended products directly from your site’s search bar.
With Autosuggest, your visitors can easily search products directly from your site’s search bar.
To integrate Unbxd Autosuggest, you need to make the below API call to Unbxd servers:
https://search.unbxd.io/yourapikey/yoursitekey/autosuggest?q=<value>&version=V2&inFields.count=<value>&popularProducts.count=<value>&keywordSuggestions.count=<value>&topQueries.count=<value>&promotedSuggestion.count=<value>&popularProducts.fields=<comma separated list of fields>&variants=<true|false>&filter=<filter_query>
The table below describes the different API parameters for an autosuggest API call.
|inFields.count||Defines number of autosuggest results with doctype IN_FIELD. The default value is 2.|
|popularProducts.count||Defines number of autosuggest results with doctype POPULAR_PRODUCTS. The default value is 3.|
|keywordSuggestions.count||Defines the number of autosuggest results with doctype KEYWORD_SUGGESTION. The default value is 2.|
|topQueries.count||Defines number of autosuggest results with doctype TOP_QUERIES. The default value is 2.|
|popularProducts.fields||Returns the fields required for popular products.|
|promotedSuggestion.count||Defines the number of autosuggest results with doctype PROMOTED_SUGGESTION. The default value is 2.|
|popularProducts.filter||Restrict the Popular Products based on criteria passed (using field name). This applies to only popularProducts in the Autosuggest API response and works similar to the “filter” request parameter for Search and Browse API|
|popularProducts.filter-id||Restrict the Popular Products based on criteria passed (using field ID). This applies to only popularProducts in the Autosuggest API response and works similar to the “filter-id” request parameter for Search and Browse API|
|filter||Restrict the products based on criteria passed (using field-name).|
|spellcheck||Enables spellcheck in autosuggest. When spellcheck=true parameter is passed in the autosuggest API, it returns did-you-mean block with spellcheck suggestion same as the search API. (default=false)|
|version||Version of the API. Passing “version” parameter is mandatory in the API. However, V1 is deprecated, please ensure that every API call has “version=V2”.|
|variants||Enables or disables variants in the API response. (default=false)|
Unbxd returns the list of products which match the search criteria. The response would be in application/json or application/xml content type format.
The table below describes the different response keys of an autosuggest call.
|autosuggest||String||The query string suggested by Unbxd for the autosuggest|
|doctype||Enum||The type of autosuggest. Possible values are “POPULAR_PRODUCTS”, “TOP_SEARCH_QUERIES”, “PROMOTED_SUGGESTION” , “IN_FIELD” , “KEYWORD_SUGGESTION”|
|unbxdAutosuggestSrc||String||The field on which autosuggest string was generated. It is present only in autosuggest results with doctype IN_FIELD.|
|unbxdAutosuggestScore||Float||The relevancy score given to the autosuggest strings by Unbxd. This is not meant to be used by the clients.|
|uniqueId||String||The random ID created for each autosuggest string. However, in the case of popular products the uniqueId is “popularProduct_” where PRODUCT_ID is the Unique ID of the product.|
|_in||List||All fields containing _in as suffix are a part of autosuggest results for which doctype is “IN_FIELD”. For example, X_in in the autosuggest response contains all the possible values of field X, which is linked to the autosuggest string.|
|price||decimal||Price of the of the suggested product. This is only for Popular product.|
|imageUrl||link||The URL of the suggested product’s thumbnail image. This is only for Popular product.|
|productUrl||link||The URL of the suggested product. This is only for Popular product.|
- Did this answer your question?