Advanced Filtering
In the "faceting" section, we highlight how one can obtain available filters for a search query and apply filters to narrow down search results. For example, after searching for "shoes", a shopper may want to narrow down results by applying a filter on the color attribute and choosing a value such as red. Doing so will show only "red" shoes in the results. If at this point, the shopper chooses yet another color, e.g. blue, Klevu will now show both the "red" and the "blue" shoes. Thus, it will apply the OR operation between the values of the same attribute. If at this stage, the shopper chooses "cotton" as a material, the system will show both the red and blue shoes, but it will also ensure all products have "cotton" as a material as well. In other words, it applies the AND operation among the different types of selected attributes.
However, there comes a time when one may want to perform complex filtering operations, or in other words, advanced filtering operations. For example, you may want to show a group of shoes where the "color is red" and the "brand is NOT Adidas". You may also want to add another group of shoes to this result set. For example, where the "color is blue or black", "brand is Nike" and the "price range is between 100 and 400". As you can see, unlike the behaviour of "faceting", in our example here, we like to have one or more groups of products matching different groups of conditions for the final set of products to be returned.
It is with this intention to allow advanced filtering operations on the result set, we have introduced a new functionality called "advanced filtering" in our API.
Before the introduction of advanced filtering, if a user had requested filters to be returned or some to be applied, Klevu used to find out a set of relevant products matching the user query. It then included/excluded any products requested explicitly to this result set. It is after this stage that it calculated all possible filters to be returned and also applied the selected filters to narrow down the search results. Thus, if an explicitly added product did not match the applied filter, it would be excluded in the final result set.
With the addition of advanced filtering, Klevu now identifies a set of relevant products matching the query. It then applies advanced filtering to this. It is after this step that it includes/excludes any products requested explicitly, calculates filters based on this result set and finally applies the selected filters to narrow down the search results. This way, if there is any filtering to be applied prior to including/excluding products explicitly, advanced filtering should be used.
Please note the advanced filtering can also be used with Category Merchandising and Recommendation APIs.
The groupCondition object can be used for applying the advanced filtering conditions so your customers can fine-tune their results based on relevant attributes.