Skip to content

Allow Zoekt to filter archived [backend]

What does this MR do and why?

Related to #411833 (closed)

backend code to allow zoekt code search to filter out archived by default. Parameter include_archived can be passed in searches to filter out archived projects.

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.

Screenshots or screen recordings

No frontend changes

How to set up and validate locally

  1. enable and configure zoekt for a namespace
  2. enable search_add_archived_filter_to_zoekt feature flag
    echo "Feature.enable(:search_add_archived_filter_to_zoekt)" | gdk rails c
  3. make sure the namespace has at least one archived project with searchable text. Since i created new projects with the default README, I searched for "To make it easy for you to get started with GitLab"
  4. do a group code search (ensure that Zoekt code search is enabled in your user preferences)
  5. include_archived=true: http://gdk.test:3000/search?group_id=107&repository_ref=main&scope=blobs&search=%22To+make+it+easy+for+you+to+get+started+with+GitLab%22&include_archived=true
    • archived results returned
  6. include_archived=false: http://gdk.test:3000/search?group_id=107&repository_ref=main&scope=blobs&search=%22To+make+it+easy+for+you+to+get+started+with+GitLab%22&include_archived=false
    • archived results not returned
  7. no param (default): http://gdk.test:3000/search?group_id=107&repository_ref=main&scope=blobs&search=%22To+make+it+easy+for+you+to+get+started+with+GitLab%22
    • archived results not returned
Edited by Terri Chu

Merge request reports