首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何搜索按提交次数排序的github项目?

如何搜索按提交次数排序的github项目?
EN

Stack Overflow用户
提问于 2015-11-28 00:08:20
回答 2查看 469关注 0票数 2

我正在考虑尝试BigQuery和GithubArchive,但我不知道如何编写一个查询,这样我就可以在代码或项目中搜索一个术语,并按提交下降的次数对结果排序。

谢谢你的建议

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-11-28 01:41:40

加载到GithubArchive中的BigQuery数据没有源代码的副本,因此在代码中搜索术语是不可能的。但是,如果您想在存储库描述中搜索一个术语,然后根据提交的数量选择顶级存储库,下面是一个如何实现它的示例(这个例子中的术语是"SQL“):

代码语言:javascript
运行
复制
select count(*) c, repository_url, repository_description
from [githubarchive:github.timeline]
where type = 'PushEvent' and repository_description contains 'SQL'
group by 2, 3
order by c desc
limit 10

这会导致

代码语言:javascript
运行
复制
14925   https://github.com/danberindei/infinispan   Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
9377    https://github.com/postgres/postgres    Mirror of the official PostgreSQL GIT repository. Note that this is just a *mirror* - we don't work with pull requests on github. To contribute, please see http://wiki.postgresql.org/wiki/Submitting_a_Patch   
4876    https://github.com/galderz/infinispan   Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
4747    https://github.com/triAGENS/ArangoDB    ArangoDB is a multi-purpose, open-source database with flexible data models for documents, graphs, and key-values. Build high performance applications using a convenient SQL-like query language or JavaScript/Ruby extensions. Use ACID transaction if you require them. Scale horizontally and vertically with a few mouse clicks.    
3590    https://github.com/webnotes/erpnext Open Source, web-based ERP based on Python, Javascript and MySQL.    
3489    https://github.com/anistor/infinispan   Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
3263    https://github.com/youtube/vitess   vitess provides servers and tools which facilitate scaling of MySQL databases for large scale web services.  
3071    https://github.com/infinispan/infinispan    Infinispan is an open source data grid platform and highly scalable NoSQL cloud data store.  
2631    https://github.com/theory/sqitch    Simple SQL change management     
2358    https://github.com/zzzeek/sqlalchemy    Mirror of SQLAlchemy
票数 1
EN

Stack Overflow用户

发布于 2015-11-28 17:57:39

代码语言:javascript
运行
复制
SELECT COUNT(1) c, repository_url, repository_description
FROM [githubarchive:github.timeline]
WHERE type = 'PushEvent' 
AND REGEXP_MATCH(repository_description, r'(?i)SQL')
GROUP BY 2, 3
ORDER BY c DESC
LIMIT 10

BigQuery支持正则表达式,因此您可以大大改进/缩小搜索结果,具有使用搜索模式与搜索引擎术语的灵活性。

以下参考资料可进一步帮助您:

BigQuery正则表达式函数

re2语法

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33966275

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档