How to customize search weight
Our extension organizes product relevance using Search engine and Query processing settings. However, sometimes you may need to manually move specific products to the top or bottom of search results, for example, for promotional purposes.
This can be done using the Search weight field, which our extension adds to the general settings on the product edit pages.
This weight allows you to set a positive or negative value to increase or decrease the product's score, thereby changing its position in the search results.
The weight is added to the product's score as is. How large a value you need depends on the search engine:
- Elasticsearch and OpenSearch: scores are usually in the hundreds or thousands, so values such as
10or100already change the order of similar products. - Sphinx: scores are much higher, usually from thousands to millions, and even more for exact matches. A weight of
100is barely noticeable there. Use much larger values, such as100000or1000000, and check the result in the storefront search.
Sphinx stores the final score with limited precision. On Sphinx 2.x, where scores often reach tens of millions, the score changes in steps of 2 to 4. Products whose scores differ only slightly can end up with the same score, and a small weight can be rounded up or down. Large values such as 100000 are not affected in practice.
Scores differ between Sphinx 2.x and Sphinx 3.x. Recheck the search weights after you upgrade Sphinx or switch to another search engine.