Skip to main content

Elasticsuite Sort Relevance Boost

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· 2 min read
Stephan Hochdörfer
Head of IT Business Operations

One of our merchants wanted to be able to influence the sort order of the product search results in Magento. Thanks to Elasticsuite's flexibility, solving this issue was a trivial task.

The merchant manually adjusts a field called "sort_relevance" in their ERP system. The data gets sychronized in an attribute in Magento which is also called "sort_relevance". It's important to know that Elasticsuite's attribute model boosting will only work for attributes with a non-nested index field. That means, in your attribute configuration the "Input Validation for Store Owner" setting needs to be set to "Integer Number" or "Decimal Number". In this case, we went with "Integer Number."

Attribute configuration for sort_relevance

Next, open "Elasticsuite > Search Engine > Optimizers" and add a new optimizer:

Creating a new Optimizer

Make sure to set the model configuration to "Based on attribute value". Since the merchant only wants to influence the sort order for search, we set the request type configuration to "Catalog Product Search" and "Catalog Product Autocomplete".

Since we selected "Based on attribute value" for the model configuration, we can select the attribute in the "Boost & Bury" section:

Configuring attribute boost

In the attribute drop-down element the "Sort Relevance" attribute should appear. Select the attribute and then decide on the boost impact and the boot value multiplier. We decided to go with a medium boost impact and a multiplier of 2.5.

As a final step save the optimizer and you are done. If you want to test your optimizer configuration, open the optimizer configuration again and scroll down to the preview section. Pick the request type and the query string you want to test and hit the preview button:

Testing the optimizer

On the left side, you can see the order of the search results before applying the optimizer. On the right side, you can see what happens after the optimizer got applied.

Since we had set the "Sort Relevance" attribute of the Impulse Duffle bag to 50, it got boosted by the optimizer and thus appears as first search result.

This feature is part of the Open-Source version of Elasticsuite. In the Premium version of Elasticsuite you'll have a lot more possibilities like boosting on behavioural data, e.g. boosting by views, sales, or conversion rate. We'll cover those features in another blogpost soon.