g1t/apps/docs/src/content/docs/guides/search.md
| 1 | --- |
| 2 | title: Search and Explore |
| 3 | description: Search all of g1t at once (repositories, code, issues, pull requests, people and workspaces) with qualifiers, and browse public projects on Explore. |
| 4 | --- |
| 5 | |
| 6 | **Search** looks through all of g1t at once: repositories, the code on |
| 7 | their default branches, issues, pull requests, people and workspaces. It |
| 8 | covers everything public, and everything private in the workspaces you |
| 9 | belong to. Signed out, you see public results only. |
| 10 | |
| 11 | **Explore**, at [g1t.sh/explore](https://g1t.sh/explore), lists public |
| 12 | projects: the recently active ones, the new ones, and the ones in a |
| 13 | language or about a topic. |
| 14 | |
| 15 | ## Search from anywhere |
| 16 | |
| 17 | There are three ways in: |
| 18 | |
| 19 | | Where | What it does | |
| 20 | | --- | --- | |
| 21 | | The search box in the top bar | Opens [g1t.sh/search](https://g1t.sh/search) with what you typed | |
| 22 | | **⌘K** (Ctrl-K on Windows and Linux) | Opens the command palette. As you type it shows matching repositories, issues, pull requests and people, the pages you can go to, and rows that search all of g1t or only code for what you typed | |
| 23 | | A project's **Code** page | **Search this repository's code** searches the project's repository, with `repo:` filled in | |
| 24 | |
| 25 | The search page has a tab for each kind of result, each with its count: |
| 26 | |
| 27 | | Tab | Searches | |
| 28 | | --- | --- | |
| 29 | | **Repositories** | Each repository's name, workspace, description, topics and the opening of its README | |
| 30 | | **Code** | The file names and contents of every repository's default branch | |
| 31 | | **Issues** | Issue titles and descriptions | |
| 32 | | **Pull requests** | Pull request titles and descriptions | |
| 33 | | **People** | Usernames and names of people, and the slugs, names and descriptions of workspaces | |
| 34 | |
| 35 | Results show the part that matched, highlighted. A code result shows the |
| 36 | lines that matched with their line numbers, and each line links to that |
| 37 | line of the file, at `/<owner>/<repo>/blob/<branch>/<path>#L<line>`. Counts |
| 38 | stop at 1,000. Results come 20 to a page. |
| 39 | |
| 40 | ## Writing a query |
| 41 | |
| 42 | Words match wherever they appear, in any order. A result has every word |
| 43 | you type. |
| 44 | |
| 45 | | You type | It finds | |
| 46 | | --- | --- | |
| 47 | | `merge queue` | Results with both words, anywhere | |
| 48 | | `"merge queue"` | The two words together, in this order | |
| 49 | | `parse -legacy` | Results with `parse` and without `legacy` | |
| 50 | | `pars` | In repositories, issues, pull requests and people, any word that starts with `pars`, such as `parser` | |
| 51 | | `parse_query(` | In code, that exact run of characters, punctuation and all | |
| 52 | |
| 53 | Code is matched as text, the way you would find something in an editor: |
| 54 | any run of three characters or more, inside words or across them. A code |
| 55 | search needs at least one word of three characters or more, unless it is |
| 56 | limited to repositories with `repo:`. |
| 57 | |
| 58 | ### Qualifiers |
| 59 | |
| 60 | Put qualifiers anywhere in the query. Most can be left out with a leading |
| 61 | `-`, such as `-label:wontfix`. |
| 62 | |
| 63 | | Qualifier | Narrows to | Applies to | |
| 64 | | --- | --- | --- | |
| 65 | | `repo:owner/name` | One repository. Give it more than once for several | Repositories, code, issues, pull requests | |
| 66 | | `org:acme` or `workspace:acme` | One workspace | Repositories, code, issues, pull requests | |
| 67 | | `language:rust` | Code in a language, or repositories mostly written in it. `ts`, `js`, `py` and `cpp` are understood | Repositories, code | |
| 68 | | `path:src/` | Code whose path contains `src/`. With `*`, a pattern: `path:*.rs`, `path:src/*/mod.rs` | Code | |
| 69 | | `is:issue`, `is:pr` | Only issues, or only pull requests | Issues, pull requests | |
| 70 | | `is:open`, `is:closed` | Issues and pull requests by state | Issues, pull requests | |
| 71 | | `is:merged`, `is:draft` | Pull requests that were merged, or are still drafts | Pull requests | |
| 72 | | `is:public`, `is:private` | Results from public or private repositories | Repositories, code, issues, pull requests | |
| 73 | | `author:ana` | Opened by someone | Issues, pull requests | |
| 74 | | `label:bug` | With a label. Quote a label with spaces: `label:"good first issue"` | Issues, pull requests | |
| 75 | | `type:code` | Which tab to open: `repositories`, `code`, `issues`, `pulls` or `people` | All | |
| 76 | |
| 77 | Without a tab or `type:`, the qualifiers choose one: `path:` opens Code, |
| 78 | `is:pr` opens Pull requests, `is:open`, `author:` or `label:` open Issues, |
| 79 | and anything else opens Repositories. A qualifier that only one kind of |
| 80 | result has rules the others out: a query with `path:` finds no people. |
| 81 | |
| 82 | Some examples: |
| 83 | |
| 84 | ```text |
| 85 | fetchEvents language:typescript path:app/ |
| 86 | "rate limit" org:acme is:issue is:open |
| 87 | crash author:ana -label:wontfix |
| 88 | router repo:acme/web repo:acme/api |
| 89 | ``` |
| 90 | |
| 91 | ## What is indexed |
| 92 | |
| 93 | Search is kept current as things change: |
| 94 | |
| 95 | | What | When it is indexed | |
| 96 | | --- | --- | |
| 97 | | A repository's name, description, topics and README | When it is created or its settings change, and on every push to its default branch | |
| 98 | | Code | On every push to the default branch: only the files the push changed | |
| 99 | | Issues and pull requests | When they are opened, edited, assigned, closed, reopened, marked ready or merged | |
| 100 | | People and workspaces | When an account or a workspace is made, or its name, description or avatar changes | |
| 101 | |
| 102 | Code is indexed from default branches only. Some files are left out: |
| 103 | |
| 104 | - vendored and generated directories, such as `node_modules`, `vendor`, |
| 105 | `third_party`, `dist`, `target` and `.next`; |
| 106 | - lockfiles, such as `package-lock.json`, `pnpm-lock.yaml`, `Cargo.lock` |
| 107 | and `go.sum`; |
| 108 | - binary files (images, fonts, archives, compiled code) and minified files; |
| 109 | - files larger than 512 KB. |
| 110 | |
| 111 | A push that changes more than 300 files has the whole default branch |
| 112 | compared instead, and files are read a few dozen at a time in the |
| 113 | background, so very large pushes appear in search over a few minutes. A |
| 114 | repository's first 5,000 files are indexed. |
| 115 | |
| 116 | Set a repository's **topics** in **Settings → Repository**. Topics show on |
| 117 | the project's page and in search results, and each opens Explore for that |
| 118 | topic. |
| 119 | |
| 120 | ## Who sees what |
| 121 | |
| 122 | Search shows you exactly what you could open yourself: |
| 123 | |
| 124 | - Public repositories, and their code, issues and pull requests, are |
| 125 | shown to everyone, signed in or not. |
| 126 | - Private repositories, and their code, issues and pull requests, are shown |
| 127 | only to members of the workspace that owns them, and to that workspace's |
| 128 | agents. |
| 129 | - People and workspaces are public, as their pages are. Search never shows |
| 130 | which workspaces someone belongs to. |
| 131 | |
| 132 | Visibility is checked when you search, against your memberships and each |
| 133 | repository's visibility as they are at that moment, not as they were when |
| 134 | something was indexed. A repository made private disappears from everyone |
| 135 | else's results at once; one made public appears in them within moments. |
| 136 | Someone removed from a workspace stops seeing its private results on their |
| 137 | next search. |
| 138 | |
| 139 | ## Explore |
| 140 | |
| 141 | [Explore](https://g1t.sh/explore) lists public projects only: |
| 142 | |
| 143 | | View | Shows | |
| 144 | | --- | --- | |
| 145 | | **Recently active** | Projects by their last push to the default branch | |
| 146 | | **New** | Projects by when they were created | |
| 147 | | **Languages** | The languages public projects are mostly written in, with how many; choose one to see its projects | |
| 148 | | **Topics** | The topics public projects have, with how many; choose one to see its projects | |
| 149 | |
| 150 | A project's language is the one most of its indexed code is written in, |
| 151 | leaving out prose and data such as Markdown, JSON and YAML. |
| 152 | |
| 153 | ## From the API and agents |
| 154 | |
| 155 | The same search is `GET /search` in the API and the `search` tool over |
| 156 | MCP. It takes `q` (the query), `type` and `page`, and needs no token for |
| 157 | public results: |
| 158 | |
| 159 | ```sh |
| 160 | curl "https://api.g1t.sh/search?q=parse_query+language:rust&type=code" |
| 161 | ``` |
| 162 | |
| 163 | With a token, private results in your workspaces are included. g1t's own |
| 164 | agents can search too, with the token their run is given. See |
| 165 | [Search g1t](/reference/api/search/search/) in the API reference and |
| 166 | [MCP tools](/reference/mcp/#search). |
| 167 | |
| 168 | `search` looks across all of g1t. To ask about one workspace's catalog, |
| 169 | docs and memory, use the [context hub](/guides/context-hub/) and its |
| 170 | `search_context` tool. |