Skip to content

Do not run index integrity worker for zoekt search

What does this MR do and why?

This MR fixes a bug where index integrity workers for Advanced search were being called when the search_type is Zoekt.

AI summary

This change refactors the search controller to reduce direct access to instance variables. Instead of checking @scope, @project, and @group directly, the code now uses the search service object's properties (search_service.scope, search_service.project, etc.). The method no_results_for_group_or_project_blobs_advanced_search? has been updated to check for advanced search type specifically rather than relying on the elasticsearch check. The code also improves the integrity worker logic to use the search service for accessing project and group information. In the tests, a shared example was added for the "does not call index integrity workers" scenario to reduce code duplication, and a new test case was added for when the search type is "zoekt". Overall, this change improves code organization by reducing direct instance variable access and centralizing search-related logic in the search service.

References

source

image

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. enable elasticsearch and zoekt in gdk (both must be enabled)
  2. enable exact code search in your user's preferences
  3. run a group or project code search for a search term that will return 0 results
  4. make sure that the namespace or project integrity worker doesn't run (gdk tail rails-background-jobs
  5. on master branch, do the same and observe that the workers do get kicked off (gdk tail rails-background-jobs

MR acceptance checklist

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

Edited by Terri Chu

Merge request reports

Loading