当前位置: 首页 > 软件库 > 云计算 > >

search-github-starred

授权协议 MIT License
开发语言 C/C++
所属分类 云计算
软件类型 开源软件
地区 不详
投 递 者 尉迟浩思
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

search-github-starred

Full-Text Search the readme, description, homepage and URL of your GitHub starred repository. Try https://searchgithub.herokuapp.com which is kept alive by synthetics of newrelic. Update: Since the AWS service is not paid so this site is not working.

This is the missing function on GitHub. GitHub site only supplies the function to search repo-descripton and also only exact phrase match. This site supports both types. Type "A B" for phrase A B and type A B for sequence not important case.

Please try: https://searchgithub.herokuapp.com.

It uses OAuth 2, React, Redux, Golang (server side), Elasticsearch, Redis and so on. Will open source later.

Local Development

  1. npm install

  2. install go extension of Visual Studio Code.

  3. change the necessary fields in .vscode/launch.json (YOUR_ fields), example:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Launch",
                "type": "go",
                "request": "launch",
                "mode": "debug",
                "remotePath": "",
                "preLaunchTask": "buildclient",
                "port": 2345,
                "host": "127.0.0.1",
                "program": "${workspaceRoot}",
                "env": {
                    "GITHUB_CLIENT_ID" : "YOUR_GITHUB_CLIENT_ID", //ouath of your github app
                    "GITHUB_CLIENT_SECRET": "YOUR_GITHUB_CLIENT_SECRET",  //ouath of your github app
                    "CallbackURL": "http://YOUR_SITE_ADDRESS/auth/callback/",
                    "AWS_ACCESS_KEY_ID": "YOUR_AWS_ACCESS_KEY_ID",  // elasticserach of aws
                    "AWS_SECRET_ACCESS_KEY": "YOUR_AWS_SECRET_ACCESS_KEY", // elasticserach of aws
                    "REDIS_URL": "YOUR_REDIS_URL" //setup your heroku redis or other service's redis
                },
                "args": []
            }
        ]
    }
  4. use Visual Studio Code to launch the server.

  5. open localhost:5000.

YOUR_REDIS_URL could be redis://localhost:6379 or redis://h:YOUR_REDIS_PWD@REDIS_ADDRESS:PORT. You can use docker run -p 6379:6379 --name some-redis -d redis to run a local dockerized Redis.

Set up AWS' Elasticserach

The keypoint is to create a AMI role to have a permission to write to AWS' Elasticsearch, then only give anonymous users the read permission.

Set up an AWS AMI

This project uses Resource-based Policies, so it does not need to add any permission to this AMI user.

Set up Elasticsearch

Launch a Elasticsearch service and choose version 2.3. The current go API is not updated to the latest Elasticsearch version yet.

Then create a new Domain, e.g. searchgithub. Then modify the access policy like this,

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "es:*",
      "Resource": “Domain ARN/githubrepos/_search"
    },
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "User ARN"
      },
      "Action": "es:*",
      "Resource": "Domain ARN/*"
    }
  ]
}

githubrepos is the fixed Elasticsearch index in this project. The first statement is let browser have read permission, and the the second is to let the server have the write permission if it has AWS access key of the AMI user.

The account name of each user will be used as the type of Elasticsearch.

Modify the Elasticsearch setting in indexAPI.go and repos.js

indexAPI.go:

awsURL = "AWS_ELASTICSEARCH_DOMAIN_ENDPOINT"

repos.js:

const client = new elasticsearch.Client({
  host: 'AWS_ELASTICSEARCH_DOMAIN_ENDPOINT/githubrepos',
});

AWS_ELASTICSEARCH_DOMAIN_ENDPOINT could be found out in AWS dashboard. E.g. https://search-searchgithub-XXXXXXXXXXXXXXXXXXXXXXXXXX.us-west-2.es.amazonaws.com

use locally dockerized Elasticsearch

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" grimmer0125/elasticsearch:2.3

Then use http://localhost:9200 as the above AWS_ELASTICSEARCH_DOMAIN_ENDPOINT in the codes.

Deployment on Heroku

Heroku' Redis add-on will automatically create the REDIS_URL as the environment config variable, shown in the dashboard setting page. The other variables needed to be added in the Heroku setting page. https://devcenter.heroku.com/articles/heroku-redis#configuring-your-instance indicates that its REDIS_URL may change at any time.

Referenced repository

The parameters and the flow about github api calls are from https://github.com/mjmsmith/starredsearch, which is a excellent project and uses Swift on server side to implement the function seraching the information on starred repositories. This repo is based on that repository and add the feature, fulll-text (elasticserach).

  • import requests import pygal from pygal.style import LightColorizedStyle as LCS, LightenStyle as LS # 处理一个api url = 'https://api.github.com/search/repositories?q=language:python&sort=stars' r = reque

  • { "current_user_url": "https://api.github.com/user", "current_user_authorizations_html_url": "https://github.com/settings/connections/applications{/client_id}", "authorizations_url": "https://api.gith

  • 请求体查询 简单查询语句(lite)是一种有效的命令行adhoc查询。但是,如果你想要善用搜索,你必须使用请求体查询(request body search)API。之所以这么称呼,是因为大多数的参数以JSON格式所容纳而非查询字符串。 请求体查询(下文简称查询),并不仅仅用来处理查询,而且还可以高亮返回结果中的片段,并且给出帮助你的用户找寻最好结果的相关数据建议。 空查询 我们以最简单的 sea

 相关资料
  • Github Search(示例) 我们还是使用Github 搜索来演示如何使用 ReactorKit。这个例子是使用 ReactorKit 重构以后的版本,你可以在这里下载这个例子。 简介 这个 App 主要有这样几个交互: 输入搜索关键字,显示搜索结果 当用户滑动列表到底部时,加载下一页 当用户点击某一条搜索结果是,用 Safari 打开链接 Action Action 用于描叙用户行为: e

  • Github Search(示例) 这个例子是我们经常会遇见的Github 搜索。它是使用 RxFeedback 重构以后的版本,你可以在这里下载这个例子。 简介 这个 App 主要有这样几个交互: 输入搜索关键字,显示搜索结果 当请求时产生错误,就给出错误提示 当用户滑动列表到底部时,加载下一页 State 这个是用于描述当前状态: fileprivate struct State {

  • telegram-github-search-bot A Github search bot for Telegram. This bot can search users, repos and issues and works well both in normal and inline mode. Installation: 1- Create a bot by talking with Bo

  • 1.接口描述 该API的功能是上传一张图片,返回图片搜索库中与该图片最相似的10张。 如果库中不足10张,则会返回全部图片。 图片要求 格式为 JPG(JPEG),BMP,PNG,GIF,TIFF 宽和高大于 8px,小于等于4000px 小于等于 5 MB 支持自动识别人脸方向 上传的图片中包含有 exif 方向信息,先按此信息旋转、翻转后再做识别人脸方向并调整。 如果照片方向混乱且 exif

  • Search Template 首先查看 Search Template 文档 /_search/template endpoint 允许我们在执行搜索请求和使用模板参数填充现有模板之前,能够使用 mustache 语言预先呈现搜索请求。 将模板参数定义为 Map <String,Object>: Map<String, Object> template_params = new HashMap<

  • Search Insert Position 描述 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no d