Skip to content

fix: give normalized project titles full title relevance - #8112

Open
MMLeafyy wants to merge 2 commits into
modrinth:mainfrom
MMLeafyy:fix/normalized-title-search-ranking
Open

MMLeafyy wants to merge 2 commits into
modrinth:mainfrom
MMLeafyy:fix/normalized-title-search-ranking

Conversation

@MMLeafyy

Copy link
Copy Markdown

Problem and fix

Searching for Waypoint or Waypoints buries wWaypoints behind lower-download projects with ordinary spaced titles. normalize_for_search already produces w-waypoints, but indexed_name is assigned the slug relevance tier (3) instead of the title tier (4).

Match name and indexed_name together at title relevance (4). Keep exact full titles at 5, slug-only matches at 3, authors at 2, and summaries at 1. This applies equally to all normalized project names; no project-specific exception, schema change, migration, or reindex is needed.

Addresses the wWaypoints ranking case in #8110 and relates to #5090. This does not implement arbitrary missing-first-letter correction (e.g. abric api).

Evidence

A fixed corpus of 230 public results for Waypoint and Waypoints, captured on October 24, 2026, was indexed in Elasticsearch 9.4.4 using the existing schema and exact query builders extracted from the baseline and patched Rust source. With the existing relevance sort:

Query Before After Score before → after
Waypoint 86 2 3 → 4
Waypoints 54 4 3 → 4

These are local replay results across project types, not a production deployment or a promise of a fixed future rank. The replay reproduced the observed production ranks before the change.

Twelve Elasticsearch assertions passed, covering singular/plural and partial title matches, exact full titles including End+, slug-only, author-only and summary-only matches, another camel-case title (JourneyMap), and empty/wildcard queries. Added normalized_titles_have_title_relevance to the repository's search integration tests.

Validation

  • cargo fmt --all -- --check: passed.
  • git diff --check: passed.
  • Elasticsearch 9.4.4 before/after replay and 12 assertions: passed.
  • SQLX_OFFLINE=true cargo clippy -p labrinth --all-targets: passed (5m 20s), including compilation of the added test.
  • Added repository integration test: compiled/linted, not executed; needs the configured test database/services.
  • cargo sqlx prepare -- --tests: unavailable (sqlx command not installed); no SQL queries were changed.

The local Elasticsearch replay used sandbox startup compatibility shims for root UID detection, an absent proc file, and JVM entitlement-agent self-attachment; search/indexing/scoring behavior was not modified.

Match normalized project names at title relevance while keeping slug-only matches at their existing tier.

Signed-off-by: MMLeafyy <mason.belong123@gmail.com>
Verify title, exact-title, slug, author, and summary relevance tiers for the wWaypoints regression.

Signed-off-by: MMLeafyy <mason.belong123@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant