How to verify sorting results
Sometimes, you may notice discrepancies between the expected sorting order and what is actually shown on the product listing page.
To check why sorting criterion or ranking factor don't meet expected sorting order, use the following tools:
1. Verify sorting results via preview mode
While editing sorting criterion or ranking factor, click the Preview button in the top bar where other buttons are located. This button opens preview mode, where sorted by this sorting criterion/ranking factor product collection is displayed. You can also filter shown products by clicking Filters button in this mode and manually configuring needed filters to get comprehension how products will be ordered in any category.
2. Check frontend calculations
On the frontend navigate to the issued category and append ?debug=sorting
to the URL to view the sorting score of each product, or if there is already executed GET
request on this page (?
presents in the URL), append &debug=sorting
.
When the page reloads, you can see the score under each product, calculated depending on which sorting criteria and/or global factors are applied. Hovering the cursor over result for the product will show the detailed calculations:
- Global score: the score which the product obtained after global rules were applied.
- Sort by score: the score which the product obtained after sorting by sorting criteria.
- Then sort by score: the score which the product obtained after sorting by subconditions.
3. Compare results and make needed adjustments
Now, when you have enough score data for a specific product or group of products, you can fine-tune the sorting criteria and/or ranking factors to meet expectations. If the results in preview mode and debug mode on the frontend do not match, you need to execute a reindex and then make the necessary adjustments to the sorting criteria and/or ranking factors.