Github GraphQL搜索与过滤 [英] Github GraphQL Search with Filtering
问题描述
根据我的有限搜索,似乎GraphQL仅支持相等过滤.因此,
Based on my limited searching, it seems GraphQL can only support equal filtering. So,
是否可以使用
- 颗星> 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
# }
# }
# }
}
}
}
}
}
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屋!