Search Ranking Recency scoring algorithm

Created on 3 September 2008, over 16 years ago
Updated 4 May 2025, 9 days ago

Updated: Comment #N

Problem/Motivation

The NodeSearch plugin for the Search module (Core search's ability to search nodes) allows admins to decide how to rank search results, using one or more scoring algorithms. These are provided by hook_ranking(), and the scores are supposed to be values between 0 and 1 for each node.

The ranking algorithm that ranks most recent content first is not providing values that cover this range well. This breaks the ability for admins to choose to rank more recent code higher in search results.

Proposed resolution

Fix the recency ranking implementation so that the node rankings for most recently updated content work better.

Remaining tasks

Viable patch with tests.

User interface changes

None, except search results will match ranking set-ups better.

API changes

None.

Original report by @BlakeLucchesi

During my Summer of Code project I noticed that the algorithm used to normalize and adjust the score given to nodes based on their recency was not producing values spread across the range of [0,1]. Using the devel module after completing a search I copy and pasted the query used to gather the results to see how the scores of the results were being distributed. I found that most often times the score attributed to a recent node was so small that it was essentially meaningless when compared to the score of other ranking modifiers.

Using this new algorithm nodes with recent timestamps receive scores that approach the maximum (the score given to it in the search admin screen) while previously this was not the case. I have attached a screen shot of the score results for a search done on a set of nodes created with a few weeks of the search. Additionally I have attached another screen shot of the same search using the old ranking algorithm. I'd love to get some more feedback on this.

Additional discussion:

- http://drupal.org/node/297505

- http://drupal.org/node/292217

πŸ› Bug report
Status

Fixed

Version

8.0 ⚰️

Component

search.module

Created by

πŸ‡ΊπŸ‡ΈUnited States BlakeLucchesi

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024