Topic search in GraphQL misses forks

I’m trying to replicate the results of topic search, specifically https://github.com/topics/standard-gem . The GraphQL query results doesn’t seem to include repository forks, ie mihai-sysbio/Human-GEM:

{
  search(first: 100, query: "topic:standard-GEM", type:REPOSITORY) {
    repos: edges {
      repo: node {
        ... on Repository {
          nameWithOwner
        }
      }
    }
  }
}

Is there a way to specify that I’d like the search results to include forks, besides querying for them?

:wave: hello there @mihai-sysbio, and welcome to the GitHub Support Community! :tada:

To include forks in the search results, you will need to add fork:true or fork:only to your query (source: Searching for repositories).

Here’s an example query that includes forks in the search results:

{
  search(first: 100, query: "fork:true topic:standard-GEM", type:REPOSITORY) {
    repos: edges {
      repo: node {
        ... on Repository {
          nameWithOwner
        }
      }
    }
  }
}

At this time of writing, here’s the result set:

{
  "data": {
    "search": {
      "repos": [
        {
          "repo": {
            "nameWithOwner": "SysBioChalmers/Human-GEM"
          }
        },
        {
          "repo": {
            "nameWithOwner": "MetabolicAtlas/standard-GEM"
          }
        },
        {
          "repo": {
            "nameWithOwner": "mihai-sysbio/Human-GEM"
          }
        }
      ]
    }
  }
}

From https://github.com/MetabolicAtlas/standard-GEM/network/members, mihai-sysbio / standard-GEM is a fork of MetabolicAtlas / standard-GEM. I hope this helps!

1 Like

Thank you @francisfuzz.
The fork: true / fork: only is easy to miss. Rather than dividing the documentation into two pages (“searching for repositories” and “searching in forks”), I would find it more intuitive to have both on the same page. That’s because I am interpreting the default value of a normal search to be “fork: false”. Also, a fork is to me a still a repository, kind of at the same level of hierarchy, but perhaps the GitHub philosophy is different.

@mihai-sysbio - You’re welcome! We’re always working to improve GitHub and the GitHub Support Community, and we consider every suggestion we receive.

Would you mind submitting this through our official product feedback form so that our product team can track your request? That’s the best place to share requests like these in consideration for future iterations of GitHub features. :v:

1 Like