What is 'query' searching on?


#1

With the search

{
  search(query: "chem", type: USER, first: 1) {
    userCount
    edges {
      node {
        ... on User {
          name
          login
        }
      }
    }
  }
}

I get results like

 {
          "node": {
            "name": "Kuniwak",
            "login": "Kuniwak"
          }
}

If I pull more attributes I eventually find something that includes ‘chem’, somewhere. So does the query look for that string to appear anywhere? Is there a way to limit a search to say “Find me users with a name that includes ‘chem’?”


#2

I could be wrong, but I think search works just like the on-site Github search. For example, the search you have above returns the same results as going to github.com, searching for “chem” and then clicking on “Users” on the left sidebar [direct link].

If you wanted to limit your search to just users with a name that includes “chem” you could use

search(query: "fullname:chem", type: USER, first: 1) {

Or, if you wanted to limit your search to find you the user with the username “chem” your query would start like

search(query: "user:chem", type: USER, first: 1) {

Essentially, it seems like whatever advanced search you can build on github.com’s search page, you can put into query.