Guide
Smart Search
Faceting
7 min
if you haven't gone through the prerequisites and the v2 structure, please have a look at overview docid\ czeodl0skcuv 18ipuplr it is important to note that retrieving filters is an expensive operation that can slow down your search experience for this reason, you may want to fetch filters once per unique query and cache them locally for example, when using pagination to retrieve records from subsequent pages, there is actually no need to fetch the filters again since these will not change from page to page the filters from klevu are always for the entire set of records for that query while searching for records, you can also request aggregations of the attribute values within the search results, so you can allow your customers to filter the results further for example, if the search query was "tops", you may also be interested to know all of the colors, sizes, and materials that these tops are available in to display them as selectable facets or filters there are two separate methods of working with filters with the klevu search api retrieving filters applicable to a search result applying one or more of those filters to a search query to apply a filter, you need to know the key of the relevant filter and the value of the relevant option, which should be submitted using the same format and case sensitivity as is returned by klevu retrieving facets the filterstoreturn object can be used for obtaining filters from the klevu search engine you can request all possible filters or only those matching certain criteria understanding response format 120,523,100 false true unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type applying facets the applyfilters object can be used for applying filter conditions so your customers can fine tune their results based on relevant attributes understanding response format if only one filter is applied with only value, klevu search ensures that all the records returned contain the relevant attribute with the specified value in the case where two or more values for the same filter are provided, the execution is dependent on the value of the singleselect parameter if it is set to true, the products returned must have both the values if it is set to false, the products returned must have at least one of the values if constraints are added for multiple filters and the value of the singleselect filter is false, the products returned must have at least one value from each of the filter conditions provided try it here!