Skip to content

Add include_archived for blobs search graphql api

Terri Chu requested to merge 501292-add-archived-for-zoekt-graphql-api into master

What does this MR do and why?

This MR adds include_archived filter for the blob search graphQL API endpoint. the filter is already present in the search service, it just needed to be passed down from graphQL (as the SearchController and Search API already do)

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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 UI changes

How to set up and validate locally

  1. enable zoekt for gdk
  2. enable ff zoekt_cross_namespace_search for global search
  3. setup a group (I used flightjs for this) and ensure it has one archived project and one un-archived project
  4. test in graphql explorer to test global, group and project search
  5. test each with no includeArchived, includeArchived: true, and includeArchived: false

global

query {
  blobSearch(
    search: "searchabletext",
  ) {
    matchCount
    perPage
    fileCount
    searchType
    searchLevel
    files {
      path
      fileUrl
    }
  }
}

group

query {
  blobSearch(
    search: "searchable",
    groupId: "gid://gitlab/Group/33",
  ) {
    matchCount
    perPage
    fileCount
    searchType
    searchLevel
    files {
      path
      fileUrl
    }
  }
}

project

project id should be the archived project id. results should return regardless of includeArchived parameter

query {
  blobSearch(
    search: "searchable",
    groupId: "gid://gitlab/Group/33",
    projectId: "gid://gitlab/Project/26"
  ) {
    matchCount
    perPage
    fileCount
    searchType
    searchLevel
    files {
      path
      fileUrl
    }
  }
}
Edited by Terri Chu

Merge request reports

Loading