How to query `search` , come back with a list of 20 ordered by stargazers totalCount?


#1
    {
      search(first: 10, query: "javascript react", type: REPOSITORY) {
        codeCount
        nodes {
          __typename
          ... on Repository {
            url
            nameWithOwner
            description
            createdAt
            stargazers(first: 10) {
              totalCount
            }
            ... on RepositoryInfo {
              __typename
              shortDescriptionHTML
              resourcePath
            }
          }
        }
      }
    }

I wanna the repositories ordered by stargazers totalCount, how can I approach that?


#2

To sort by stargazers, you can use this search query:

javascript react sort:stars-desc

If this doesn’t work for you, let us know!


#3

Aha. really thanks, is there any docs talk about this?


#4

No worries! The search syntax isn’t documented in the GraphQL docs, but it’s actually the same syntax that we use in other parts of the site. The docs for the syntax is here: https://help.github.com/articles/understanding-the-search-syntax/