Configurations
If you haven't gone through the prerequisites and the v2 structure, please have a look at Overview
There are numerous settings, preferences, and configurations available with APIv2 to fine-tune your search and category merchandising queries. This section explores them in more detail.
The default sorting of results is RELEVANCE, which uses Klevu A.I. to determine the order. There are various other options available which you can provide to your customers as required.
You may wish to split larger result sets over multiple pages. You can do this using pagination. Simply specify a page size for how many results each page should include, and an offset of which record to start each result set from.
Understanding response format
Params | Description | |
noOfResults | The number of results requested to be returned for this query. | |
totalResultsFound | The total number of results found for this query. | |
offset | The index of the first result returned in this response. | |
typeOfSearch | The query type that was executed by Klevu to retrieve the results. | |
By default, Klevu will return most of the data available in a record. If you only need certain elements and want to keep the response size small for performance reasons, you can specify only the fields you are interested in.
The groupBy parameter takes the name of a field indexed in the Klevu Search backend and ensures that there is only one record for each unique value of this field in the search results.
By default, the groupBy operation is performed on the itemGroupId field. When querying for KLEVU_CATEGORY or KLEVU_CMS records, it is recommended to use name as the groupBy parameter value.
The typeOfSearch parameter defines the behaviour when identifying matches for a searched term. For example, whether all or just one of the entered words must be matched, whether to allow spelling mistakes, etc.
There are a number of preferences available for fine-tuning your queries. For example, you can control whether or not to allow fuzzy search for spelling mistakes on a query by query basis. The available searchPrefs are detailed below.