且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 GitHub GraphQL Api 获取按星级排名前 10 的 javascript/开源存储库

更新时间:2023-01-30 13:00:08

我从 GitHub Support 得到了部分解释结果不一致的原因:是由于查询运行时超时很长.

I got an partial explanation from GitHub Support about the reason of why the results are inconsistent: it's due to the fact that there is a timeout when queries run for too long.

对于我们的搜索基础架构执行而言,某些查询的计算成本很高.为了让每个人都能快速搜索,我们限制了任何单个查询可以运行的时间.在查询超过时间限制的极少数情况下,搜索会返回超时前找到的所有匹配项,并通知您超时发生.

Some queries are computationally expensive for our search infrastructure to execute. To keep search fast for everyone, we limit how long any individual query can run. In rare situations when a query exceeds the time limit, search returns all matches that were found prior to the timeout and informs you that a timeout occurred.

达到超时并不一定意味着搜索结果不完整.这只是意味着在搜索所有可能的数据之前查询已停止.

Reaching a timeout does not necessarily mean that search results are incomplete. It just means that the query was discontinued before it searched through all possible data.

我们的团队在这里写了这篇文章:

Our team wrote about this here:

https://help.github.com/articles/故障排除搜索查询/#potential-timeouts

鉴于这一现实,这些超时可能会导致在翻阅结果时出现不一致.我们看到了在未来的搜索迭代中可以如何改进这一点,所以我们已经让我们的团队知道,让他们知道,尽管我们不能对具体的变化做出任何承诺.

Given this reality, these timeouts may cause inconsistencies while paging through the results. We see how this could be improved in future iterations of search, so we've let our team know so they're aware though we can't make any promises on specific changes.

由支持提供,添加query: "language:javascript stars:>1600"(1600 或多或少是前 3000 个代表的最小星数,但需要很大足以缩小搜索范围)将始终提供按星级排序的前 10 个存储库.

Provided by the support, adding query: "language:javascript stars:>1600" (1600 is more or less the minimum star count of the top 3000 reps but need to be big enough to narrow the search) will provide consistently the top 10 repos ordered by star.