Skip to content

Conversation

@002love
Copy link
Contributor

@002love 002love commented Dec 30, 2025

Fixes #12579

Rationale

Currently, user search results are often dominated by inactive accounts, making it difficult to find active community members or staff. This PR introduces a boosting mechanism in Elasticsearch to prioritize relevant users without affecting the accuracy of string matching

Changes

  • Elasticsearch Mapping: added groups field to the users index mapping
  • Indexing: updated UserSearch trait to include user group IDs in the search index
  • Search Logic:
    • refactored UserSearch::getQuery() to use a nested bool query
    • string matching is now inside a must block to maintain strict minimum_should_match: 1 requirements
    • added should clauses for boosting:
      • Staff & BN (PPY, GMT, NAT, BN, DEV): boost: 5
      • Contributors (Alumni, Project Loved): boost: 2
      • Recent Activity (Active within last 30 days): boost: 1.5
    • Performance: group ids are retrieved via identifiers and cached in static variables to ensure zero database overhead
Master This PR
image image

if ($boost_groups === null) {
$getGroupId = fn ($identifier) => app('groups')->byIdentifier($identifier)?->getKey();

$boost_groups = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would suggest adding the following groups to boosts so all relevant usergroups are covered:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. but I'm not sure if the group tags support, featured_artist, beatmap_spotlights, tournament_staff are 100% correct

@notbakaneko notbakaneko self-requested a review January 3, 2026 05:39
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.

Prioritize certain users in search

2 participants