Skip to content

Conversation

@GruperTal
Copy link

@GruperTal GruperTal commented Dec 22, 2025

Description

Improves search result ranking by incorporating TMDB popularity scores into the sorting algorithm. Previously, search results were returned in TMDB's default order which prioritizes text matching over popularity, causing obscure titles to appear above well-known ones.

Problem
When searching for partial titles (e.g., "the hunger"), less popular movies with closer text matches would appear before highly popular titles like "The Hunger Games" franchise.

Solution
Implemented a scoring system that combines:
Popularity (primary factor) - TMDB popularity score weighted heavily
Text relevance (secondary factor) - small boosts for titles starting with or exactly matching the query
This ensures popular titles rank appropriately while still giving slight preference to closer text matches when popularity is similar.

Changes
Added calculateSearchScore() function that computes a weighted score
Added sortResultsByRelevanceAndPopularity() to sort results by combined score
Applied sorting to all search results including special search providers (year:, tmdb:, etc.)

Testing
Tested with queries like "the hunger" - The Hunger Games movies now appear before obscure titles like "The Hunger".

To-Dos

  • Successful build yarn build

even when less popular titles have closer text matches.mprove search ranking by incorporating
popularity score
@GruperTal GruperTal changed the title feat(search.ts): mprove search ranking by incorporating popularity score feat(search.ts): improve search ranking by incorporating popularity score Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant