Skip to content

Feat/4211: Related Posts: Add setting to weight results by date #4294

Draft
Sidsector9 wants to merge 2 commits intodevelopfrom
feat/4211
Draft

Feat/4211: Related Posts: Add setting to weight results by date #4294
Sidsector9 wants to merge 2 commits intodevelopfrom
feat/4211

Conversation

@Sidsector9
Copy link
Member

@Sidsector9 Sidsector9 commented Feb 26, 2026

Description of the Change

Default decay values

The defaults are intentionally more conservative than Search's weight_recent() because related posts have a longer useful lifespan, a well-written article from several months ago is still a good recommendation, unlike search results where recency matters more.

  • Scale (360d vs Search's 14d): score decays over a full year instead of two weeks
  • Offset (30d vs Search's 7d): posts within a month are completely unpenalized
  • Decay (0.5 vs Search's 0.25): at the scale distance, score is halved rather than quartered (gentler)

Closes #4211

How to test the Change

  1. Add a lot of dummy related posts to your site, where the created date spans over at least 3 years.
  2. Go to ElasticPress > Features > Core Search > Related Posts.
  3. Verify the new "Weight related posts by date" checkbox setting is visible.
  4. With the setting disabled, view a post with the Related Posts block or widget. Note the order of results. They should be based on content relevance only, with old posts appearing freely.
  5. Enable the "Weight related posts by date" setting and save.
  6. View the same post again. Newer related posts should now be favored over older ones in the results.
  7. Disable the setting again and confirm the results return to pure relevance ordering.

Changelog Entry

Added: "Weight related posts by date" setting to the Related Posts feature, allowing newer content to be favored in results using Elasticsearch's date decay function.
Fixed - Related posts being sorted by date instead of relevance score, causing more_like_this scores to be ignored.

Credits

Props @burhandodhy @Sidsector9

Checklist:

@Sidsector9 Sidsector9 self-assigned this Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant