What is the “Advanced scoring” add-on?
Every WooCommerce store owner wants to solve the “Freshness vs relevant” paradigm.
By default, results in a search are ordered by relevancy: the most relevant products related to the search keywords are displayed first.
But what if the most relevant products are also the oldest ? or the more expensive ? Showing older or more expensive products first is not good, everyone can agree on that.
Hey, but why not sort results by recent dates or lower prices ? Sure, it should solve the issue, no ?
Well, unfortunately, it would not. Because sorting is a very destructive option: it erases completely the results relevancy. Which means instead of getting old or expensive relevan results, you would get new or cheap un-relevant results.
Decay scoring
Scoring is how search engines like Elasticsearch are sorting results by default. It gives a score, a number, to every document in the index, relative to the search keywords.
When you set another sort, like date or price, you just give away the scoring.
The idea with decay scoring, used by the Advanced Scoring Extension, is to continue to use the score as the default sort. By modifying the scoring number with a function that includes a “decay”.
The “decay” being a distance calculated from a date or a number, like the posts publication date or the products price, or products stock quantity, or any other products promotional indicator.
See a detailed Elasticsearch decay function documentation
Activate the “Advanced scoring” add-on
- Select the “Extensions” tab
- Select the “Advanced scoring” tab
- Select the “Activate the “” extension checkbox
- Save
Activate the “Decay scoring” option
“Decay scoring” is the first scoring implemented in the “Advanced scoring” extension. Other scorings will follow.
- Activate the “Decay scoring” extension
- Select the fields that will be modified by the decay scoring. Only fields which have a numeric or a date type in tab 2.2 will be selectable here. More detailed on each field type setup below in the documentation.
- Save
Decay scoring on a Date field
Here is a description of the decay settings for a Date field. Here we selected the post type date field.
Let’s assume we want to display post types that are accurate, but also are recent.
- the “displaydate_dt” field was selected on the previous step.
- Select the type of decay function (Elasticsearch decay function documentation)
- Select the origin for the decay function: now.
The farther from now your results are, the more penalty they get. - Select the origin for the decay function: a fixed date.
The farther from the fixed date your results are, the more penalty they get. - Enter a start, in days.
From origin to start, no penalty is applied. - Enter a distance from start, in days.
This is an estimation of how far the penalty will be applied. - Enter a penalty, in %.
Set a penalty value > 0 and < 1. It defines how much penalty is applied to values at the start + distance you defined above. “0.33” means the score is divided by 3 at the start + distance. Other penalties from offset are calculated by the function shape.
Decay scoring on a numeric field
Here is a description of the decay settings for a Numeric field. Here we selected the price field.
Let’s assume we want to display products that are accurate, but also are cheap (or expensive).
- A price field was selected on the previous step.
- Select the type of decay function (Elasticsearch decay function documentation)
- Select the origin for the decay function.
The farther from it your results are, the more penalty they get. So, enter “0” to display low prices first, and “999999” to display first high prices. - Enter a start.
From origin to start, no penalty is applied. - Enter a distance from start.
This is an estimation of how far the penalty will be applied. - Enter a penalty, in %.
Set a penalty value > 0 and < 1. It defines how much penalty is applied to values at the start + distance you defined above. “0.33” means the score is divided by 3 at the start + distance. Other penalties from offset are calculated by the function shape.