Skip to content
Snippets Groups Projects

Use search service for project autocomplete

What does this MR do and why?

Autocomplete is slow for searching projects and groups. This is because these are doing global searches using database calls and on every call it has to compute current_user.authorized_projects and current_user.authorized_groups.

This MR changes the projects autocomplete from always using a database search to using the SearchService which uses Elasticsearch if it's available which should be quicker.

The change is behind a feature flag: autocomplete_projects_use_search_service

Future

I'm thinking we can extend this to search over fewer fields (just project name, namespace name) which will be much faster and better aligned with autocomplete behaviour.

We can also cache heavy operations like determining a user's authorized projects and groups for a few minutes so that subsequent autocomplete and search calls are much faster. I think this will have the biggest impact on autocomplete slowness.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Disable the feature flag: Feature.disable(:autocomplete_projects_use_search_service)
  2. Perform an autocomplete: type s or / in gitlab. Note the results
  3. Enable the feature flag: Feature.enable(:autocomplete_projects_use_search_service)
  4. Perform the same autocompletes and note the same results are returned

Related to #472011 (closed)

Edited by Madelein van Niekerk

Merge request reports

Merge train pipeline #1502288910 passed

Merge train pipeline passed for a8fe3dc0

Merged by John MasonJohn Mason 5 months ago (Oct 18, 2024 1:32pm UTC)

Loading

Pipeline #1502291028 passed

Pipeline passed for e5891e43 on master

10 environments impacted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Reviewer roulette

    Category Reviewer Maintainer
    backend @hmerscher profile link current availability (UTC+2, same timezone as author) @lma-git profile link current availability (UTC-7, 9 hours behind author)

    Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

    Edited by Ghost User
  • Madelein van Niekerk
  • Madelein van Niekerk changed the description

    changed the description

  • added 1 commit

    • fd80dd5a - Apply 2 suggestion(s) to 1 file(s)

    Compare with previous version

  • Madelein van Niekerk marked this merge request as ready

    marked this merge request as ready

  • requested review from @rkumar555

  • Ravi Kumar approved this merge request

    approved this merge request

  • @terrichu Could you please do the maintainer review?

  • Ravi Kumar requested review from @terrichu and removed review request for @rkumar555

    requested review from @terrichu and removed review request for @rkumar555

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading