algolia / github-awesome-autocomplete

:octocat: Add instant search capabilities to GitHub's search bar
https://github.algolia.com
Other
1.07k stars 93 forks source link

Star count discrepancy #40

Closed Mottie closed 8 years ago

Mottie commented 8 years ago

The result shown in the autocomplete dropdown has a star count that doesn't match the actual repository star count.

awesome-autocomplete

The screenshot shows github-awesome-autocomplete having 375 stars, while the "Unstar" button is showing 281.

rayrutjes commented 8 years ago

This is weird, here is a hit resulting from a query:

{
                    "name": "github-awesome-autocomplete",
                    "owner": "algolia",
                    "description": "Add instant search capabilities to GitHub's search bar",
                    "organization": "algolia",
                    "watchers": 375,
                    "forks": 45,
                    "fork": false,
                    "language": "JavaScript",
                    "full_name": "algolia/github-awesome-autocomplete",
                    "stars": "4",
                    "objectID": "algolia/github-awesome-autocomplete",

                    [...]
}

You are actually using the watcher value, which also is not accurate. I think there might be a problem in the algolia robot parsing github? Stars always equals 4, am I missing something?

Mottie commented 8 years ago

If I use GitHub's API: https://api.github.com/search/repositories?q=github-awesome-autocomplete

The count is correct:

{
  "total_count": 2,
  "incomplete_results": false,
  "items": [
    {
      "id": 28206168,
      "name": "github-awesome-autocomplete",
      "full_name": "algolia/github-awesome-autocomplete",
      "owner": {
        "login": "algolia",
        "id": 2034458,
        "avatar_url": "https://avatars.githubusercontent.com/u/2034458?v=3",
        "gravatar_id": "",
        "url": "https://api.github.com/users/algolia",
        "html_url": "https://github.com/algolia",
        "followers_url": "https://api.github.com/users/algolia/followers",
        "following_url": "https://api.github.com/users/algolia/following{/other_user}",
        "gists_url": "https://api.github.com/users/algolia/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/algolia/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/algolia/subscriptions",
        "organizations_url": "https://api.github.com/users/algolia/orgs",
        "repos_url": "https://api.github.com/users/algolia/repos",
        "events_url": "https://api.github.com/users/algolia/events{/privacy}",
        "received_events_url": "https://api.github.com/users/algolia/received_events",
        "type": "Organization",
        "site_admin": false
      },
      "private": false,
      // ... collapsed
      "homepage": "https://github.algolia.com",
      "size": 12987,
      "stargazers_count": 282, // <--- now it's 282
      "watchers_count": 282,
      "language": "JavaScript",
      "has_issues": true,
      "has_downloads": true,
      "has_wiki": true,
      "has_pages": false,
      "forks_count": 23,
      "mirror_url": null,
      "open_issues_count": 15,
      "forks": 23,
      "open_issues": 15,
      "watchers": 282,
      "default_branch": "master",
      "score": 87.3987
    },
redox commented 8 years ago

Yeah it's related to https://github.com/algolia/github-awesome-autocomplete/issues/31 -> the way we're importing the data (from https://www.githubarchive.org/) month over month don't take into account the "unstars/unwatch". Unfortunately, we cannot call the GitHub API to fix it, it's way too much restricted in terms of API calls/day.

Not yet sure what we could do to improve it.

I'm closing it in favor of #31