Skip to content

Add include_forked for blobs search graphql api

Terri Chu requested to merge 501293-add-forked-for-zoekt-graphql-api into master

What does this MR do and why?

This MR adds include_forked 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

N/A

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 at least one forked project
  4. test in graphql explorer to test global, group and project search
  5. test each with no includeForked, includeForked: true, and includeForked: 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 forked project id. results should return regardless of includeForked 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