Github GraphQL 搜索与过滤 [英] Github GraphQL Search with Filtering

查看:24
本文介绍了Github GraphQL 搜索与过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Based on my limited searching, it seems GraphQL can only support equal filtering. So,

是否可以使用以下过滤条件进行 Github GraphQL 搜索,

Is it possible to do Github GraphQL searching with the filtering conditions of,

  • 星星 > 10
  • 叉> 3
  • 总提交 >= 5
  • 问题总数 >= 1
  • 未解决的问题 <= 60
  • 大小 > 2k
  • 得分 > 5
  • 上次更新在一年内

即,过滤将所有上述条件.可能吗?

I.e., filtering will all above conditions. Is it possible?

推荐答案

在查询仓库时,您可以只对列表中的特定数量的字段应用过滤器:

When querying for repositories, you can apply a filter only for a certain number of the fields in your list:

  • 星数
  • 分叉数量
  • 尺寸
  • 最后更新

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

Although you cannot specify them in the query filter, you can include other fields in your query and verify the values in the client application:

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

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

While, in theory, you can also query for the number of commits, applying your specific parameter arguments, that query returns a server error, it most probably times out. For that reason, those lines are commented out.

这是 GraphQL 查询:

Here's the GraphQL query:

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

The specification for repository queries can be found here: https://help.github.com/en/articles/searching-for-repositories#search-by-repository-size

这篇关于Github GraphQL 搜索与过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆