Make Zoekt force re-indexing probability configurable
What does this MR do and why?
Make the Zoekt force re-indexing probability configurable to allow tuning and provide flexibility for Self-Managed and Dedicated customers.
The REINDEXING_CHANCE_PERCENTAGE was previously hardcoded at 0.5%, which caused excessive work for very large repositories. This change makes it configurable via Admin UI settings and reduces the default to 0.25%.
Changes:
- Add
zoekt_reindexing_chance_percentagesetting toSearch::Zoekt::Settings - Add jsonb_accessor in
ApplicationSettingwith default of 0.25% (reduced from 0.5%) - Add JSON schema validation for the new setting
- Add validation ensuring value is between 0-100
- Update
IndexingTaskServiceto use configurable setting instead of hardcoded constant - Add proper handling for 0% (disables random re-indexing) and 100% (always forces re-indexing)
- Add comprehensive test coverage including edge cases
- Update documentation with new setting usage
The setting can be configured via Admin > Settings > Search > Exact code search. It is positioned after "Indexing CPU to tasks multiplier" for logical grouping with other resource/performance-related indexing settings.
References
Closes #586407 (closed)
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Start your GDK and ensure Zoekt is enabled
- Navigate to Admin > Settings > Search > Exact code search
- Locate the "Probability of random force re-indexing (%)" field (positioned after "Indexing CPU to tasks multiplier")
- Set a value between 0 and 100:
-
0- Disables random force re-indexing completely -
0.25- Default (0.25% probability) -
100- Always forces re-indexing
-
- Save changes
- Verify the setting is persisted by refreshing the page
- In a Rails console, verify the setting:
ApplicationSetting.current.zoekt_reindexing_chance_percentage # => 0.25 (or your configured value) - Verify it's used in the service:
Search::Zoekt::Settings.reindexing_chance_percentage # => 0.25 (or your configured value)
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.

