Github 带过滤功能的 GraphQL 搜索

Github GraphQL Search with Filtering

根据我有限的搜索,GraphQL 似乎只能支持相等过滤。所以,

是否可以使用

的过滤条件进行 Github GraphQL 搜索

即过滤将所有以上条件。可能吗?

这不是答案,而是对我目前收集的内容的更新。

  • 根据“”,并非所有上述条件都可以在存储库边缘中使用。即,"total commit"、"open issues" 和 "score" 可能不可用。

  • 问题的目的显然是找到有价值的存储库并剔除 lower-quality 的存储库。我 collected all the available fields that might be helpful for such assessment here

截至 2018-03-18 的副本:

query SearchMostTop10Star($queryString: String!, $number_of_repos:Int!) {
  search(query: $queryString, type: REPOSITORY, first: $number_of_repos) {
    repositoryCount
    edges {
      node {
        ... on Repository {
          name
          url
          description
#         shortDescriptionHTML
          repositoryTopics(first: 12) {nodes {topic {name}}}
          primaryLanguage {name}
          languages(first: 3) { nodes {name} }
          releases {totalCount}
          forkCount
          pullRequests {totalCount}
          stargazers {totalCount}
          issues {totalCount}
          createdAt
          pushedAt
          updatedAt
        }
      }
    }
  }
}
variables {
  "queryString": "language:JavaScript stars:>10000", 
  "number_of_repos": 3 
}

任何人都可以尝试一下 as per here

查询存储库时,您可以仅对列表中一定数量的字段应用过滤器:

  • 星数
  • 餐叉数量
  • 尺码
  • 最后更新

虽然您不能在查询过滤器中指定它们,但您可以在查询中包含其他字段并在客户端应用程序中验证这些值:

  • 问题总数
  • 未解决的问题数量

虽然从理论上讲,您还可以查询提交次数,应用您的特定参数参数,该查询 returns 服务器错误,很可能会超时。因此,这些行被注释掉了。

这是 GraphQL 查询:

query {
  search(
    type:REPOSITORY, 
    query: """
      stars:>10
      forks:>3
      size:>2000
      pushed:>=2018-08-08
    """,
    last: 100
  ) {
    repos: edges {
      repo: node {
        ... on Repository {
          url

          allIssues: issues {
            totalCount
          }
          openIssues: issues(states:OPEN) {
            totalCount
          }

          # commitsCount: object(expression: "master") {
          #   ... on Commit {
          #      history {
          #       totalCount
          #     }
          #   }
          # }
        }
      }
    }
  }
}

可在此处找到存储库查询的规范:https://help.github.com/en/articles/searching-for-repositories#search-by-repository-size