Rules can be used to pin specific items based on a query or to boost an entire subset of the results that matches a filter value.
It is not possible to use Rules to pin a subset of records with specific filter/attribute values to specific numerical positions.
For example, your store sells computers and you want to ensure that for any user search:
- the first three results are Apple products
- the fourth result is a Dell product
- all subsequent positions are returned according to your index's normal relevancy,
You would need to consider an alternative approach without Rules. One possible approach to this use case would be to (substantially) customize your search and perform multiple queries:
- one query with the filter
brand: Appleto populate the first three positions
- a second query with the filter
brand: Dellto populate the fourth position
- a third query with no filter for the brand attribute, which would populate all results after the fourth position; this query would require additional logic to filter out the results from the first two queries in order to prevent them from displaying again, which would be the most complex aspect of coding this solution
Our knowledge article on customizing Magento to add a filter search would be a good starting point for this approach.
last reviewed Dec. 20, 2022