Allow user namespaces to be indexed in Zoekt for self-managed

What does this MR do and why?

This MR enables Zoekt code search indexing for projects under user namespaces (personal projects) on self-managed GitLab instances.

Previously, the auto_index_self_managed task only indexed group namespaces, excluding personal projects from Zoekt indexing. This change removes the group_namespaces filter to include both group and user namespaces.

Why is this needed?

  1. Complete code search coverage - All projects should be searchable, not just group projects
  2. Better user experience - Personal projects can now use exact code search
  3. Consistency - Matches user expectations that all projects should be indexed

Important: SaaS Safety

This change only affects self-managed instances. The method already has guards to prevent running on GitLab.com:

def auto_index_self_managed
  return if Gitlab::Saas.feature_available?(:exact_code_search)  # ← Prevents running on SaaS
  return unless Gitlab::CurrentSettings.zoekt_auto_index_root_namespace?
  # ...
end

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Enable Zoekt auto-indexing in your self-managed instance:

    ApplicationSetting.current.update!(zoekt_auto_index_root_namespace: true)
  2. Create a personal project (under a user namespace)

  3. Run the scheduling task:

    Search::Zoekt::SchedulingService.execute!(:auto_index_self_managed)
  4. Verify that the user namespace is now in Search::Zoekt::EnabledNamespace:

    Search::Zoekt::EnabledNamespace.where(root_namespace_id: user.namespace.id).exists?
    # Should return true

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.

Query report

https://console.postgres.ai/shared/ed1702d2-7fb1-4717-84f5-8f8303dc2f85

Closes #585512 (closed)

Edited by Ravi Kumar

Merge request reports

Loading