Skip to content

Commit

Permalink
fixes to bad links + reorganization
Browse files Browse the repository at this point in the history
  • Loading branch information
saritai committed Nov 1, 2022
1 parent 56fe624 commit c977fb4
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ topics:

## About GitHub Code Search (beta)

GitHub Code Search (beta) lets you rapidly search, navigate and understand your code, your team's code, and the code of the open source community, all from GitHub.com. This search engine is designed to be scalable, code-aware, and support searching code across GitHub using regular expressions, boolean operations, specialized qualifiers, and keyboard shortcuts. For more information on the syntax of GitHub Code Search (beta), see "[Understanding GitHub Code Search (beta) syntax](/articles/understanding-github-code-search-syntax)."
GitHub Code Search (beta) lets you rapidly search, navigate and understand your code, your team's code, and the code of the open source community, all from {% data variables.product.prodname_dotcom_the_website %}. This search engine is designed to be scalable, code-aware, and support searching code across GitHub using regular expressions, boolean operations, specialized qualifiers, and symbol search. For more information on the syntax of GitHub Code Search (beta), see "[Understanding GitHub Code Search (beta) syntax](/search-github/github-code-search/understanding-github-code-search-syntax)."

On top of the new code search engine, GitHub Code Search (beta) includes new features in the search interface on GitHub.com, allowing you to more quickly and easily find what you are looking for, including suggestions, completions, and the ability to save your searches. For more information, see "[Using GitHub Code Search (beta)](/articles/using-github-code-search)."
On top of the new code search engine, GitHub Code Search (beta) includes new features in the search interface on {% data variables.product.prodname_dotcom_the_website %}, allowing you to more quickly and easily find what you are looking for, including suggestions, completions, and the ability to save your searches. For more information, see "[Using GitHub Code Search (beta)](/search-github/github-code-search/using-github-code-search)."

Note that the syntax and qualifiers for searching for non-code content, such as issues, users, and discussions, works the same as it did before, in the classic search. For more information on the classic search, see "[About search on GitHub](/articles/about-search-on-github) and "[Searching on GitHub](/search-github/searching-on-github/index.md)."
{% data reusables.search.non-code-search-explanation %}

GitHub Code Search (beta) is tightly integrated with a redesigned code view (beta) on GitHub.com. {% data reusables.search.code-view-link %}
GitHub Code Search (beta) is tightly integrated with a redesigned code view (beta) on {% data variables.product.prodname_dotcom_the_website %}. {% data reusables.search.code-view-link %}

To get access to GitHub Code Search (beta), along with the new code view, you can sign up for the [waitlist](https://github.com/features/code-search-code-view/signup).

## Enabling and disabling GitHub Code Search (beta)

Once you are given access to the GitHub Code Search and Code View beta, you can enable or disable GitHub Code Search on GitHub.com anytime. Note that this setting applies to both the search and the code view.
Once you are given access to the GitHub Code Search and Code View beta, you can enable or disable GitHub Code Search on {% data variables.product.prodname_dotcom_the_website %} anytime. Note that this setting applies to both the search and the code view.

{% data reusables.feature-preview.feature-preview-setting %}
1. To the right of "New Code Search and Code View (Beta)", click **Enable** or **Disable**.
Expand All @@ -40,17 +40,16 @@ Once you are given access to the GitHub Code Search and Code View beta, you can
We have indexed more than 10 million public repositories for GitHub Code Search (beta). Additionally, the private repositories of GitHub users in the beta are indexed and searchable by beta participants that already have access to those private repositories on GitHub.com. However, very large repositories may not be indexed at this time, and not all code is indexed.

The current limitations on indexed code are:
- Vendored and generated code is excluded (as determined by [Enry](https://github.com/go-enry/go-enry))
- Empty files and files over 350 KiB are excluded
- Only UTF-8 encoded files are included
- Very large repositories may not be indexed
- Vendored and generated code is excluded (as determined by [Enry](https://github.com/go-enry/go-enry))
- Empty files and files over 350 KiB are excluded
- Only UTF-8 encoded files are included
- Very large repositories may not be indexed

We currently only support searching for code on the default branch of a repository.

Results for any search with GitHub Code Search (beta) are restricted to 100 results (10 pages). This limitation only applies to searching code with GitHub Code Search (beta) and does not apply to other types of searches.

ADD SYMBOL SEARCH INFO HERE

GitHub Code Search (beta) supports searching for symbol definitions in code, such as function or class definitions, using the `symbol:` qualifier. However, note that the `symbol:` qualifier only searches for definitions and not references, and not all symbol types or languages are fully supported yet. For a list of what languages are supported, see "[Symbol qualifier](/search-github/github-code-search/understanding-github-code-search-syntax#symbol-qualifier)."
## Feedback and support

You can view and share feedback about GitHub Code Search (beta) in our [discussion forum](https://github.com/orgs/community/discussions/categories/code-search-and-navigation).
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ topics:

## About the GitHub Code Search query structure

Please note that the search syntax in this article only applies to searching code with the GitHub Code Search (beta). The syntax and qualifiers used when searching for other search types such as issues, pull requests, and wikis works the same way as it does with the classic search on GitHub.com. For more information, see "[Searching on GitHub](/search-github/searching-on-github/index.md)."
The search syntax in this article only applies to searching code with the GitHub Code Search (beta) enabled. {% data reusables.search.non-code-search-explanation %}

Search queries consist of search terms, consisting of text you want to search for, and qualifiers, which narrow down the search.

Expand Down Expand Up @@ -97,6 +97,13 @@ You can use parentheses to express more complicated boolean expressions. For exa
## Using qualifiers

You can use specialized keywords to qualify your search.
- [Repository qualifier](#repository-qualifier)
- [Organization and user qualifiers](#organization-and-user-qualifiers)
- [Language qualifier](#language-qualifier)
- [Path qualifier](#path-qualifier)
- [Symbol qualifier](#symbol-qualifier)
- [Content qualifier](#content-qualifier)
- [Is qualifier](#is-qualifier)

### Repository qualifier

Expand Down Expand Up @@ -151,12 +158,94 @@ For a complete list of supported language names, see [languages.yaml](https://gi

### Path qualifier

TBD
To search within file paths, use the `path:` qualifier. This will match files containing the term anywhere in their file path. For example, to find files containing the term `unit_tests` in their path, use:

```
path:unit_tests
```
The above query will match both `src/unit_tests/my_test.py` and `src/docs/unit_tests.md` since they both contain `unit_test` somewhere in their path.

To match only a specific filename (and not part of the path), you could use a regular expression:

```
path:/(^|\/)README\.md$/
```
Note that the `.` in the filename is escaped, since `.` has special meaning for regular expressions. For more information about using regular expressions, see "[Using regular expressions](#using-regular-expressions)."

<br>

You can also use some limited glob expressions in the `path:` qualifier.

For example, to search for files with the extension `txt`, you can use:

```
path:*.txt
```
<br>
To search for JavaScript files within a `src` directory, you could use:

```
path:src/*.js
```

- By default, glob expressions are not anchored to the start of the path, so the above expression would still match a path like `app/src/main.js`. But if you prefix the expression with `/`, it will anchor to the start. For example:

```
path:/src/*.js
```
- Note that `*` doesn't match the `/` character, so for the above example, all results will be direct descendants of the `src` directory. To match within subdirectories, so that results include deeply nested files such as `/src/app/testing/utils/example.js`, you can use `**`. For example:

```
path:/src/**/*.js
```
<br>

You can also use the `?` global character. For example, to match the path `file.aac` or `file.abc`, you can use:

```
path:*.a?c
```
<br>
To search for a filename which contains a special character like `*` or `?`, just use a quoted string:

```
path:"file?"
```

Since glob expressions are disabled for quoted strings, so the above query will only match paths containing the literal string `file?`.

### Symbol qualifier

TBD
You can search for symbol definitions in code, such as function or class definitions, using the `symbol:` qualifier. Symbol search is based on parsing your code using the open source [Tree-sitter](https://github.com/tree-sitter) parser ecosystem, so no extra setup or build tool integration is required.

For example, to search for a symbol called `WithContext`:

```
language:go symbol:WithContext
```

In some languages, you can search for symbols using a prefix (e.g. a prefix of their class name). For example, for a method `deleteRows` on a struct `Maint`, you could search `symbol:Maint.deleteRows` if you are using Go, or `symbol:Maint::deleteRows` if you are using Go, or `symbol:Maint::deleteRows` in Rust.

You can also use regular expressions with the symbol qualifier. For example, the following query would find conversions people have implemented in Rust for the `String` type:

```
language:rust symbol:/^String::to_.*/
```

Note that this qualifier only searches for definitions and not references, and not all symbol types or languages are fully supported yet. Symbol extraction is supported for the following languages.

- C#
- Python
- Go
- Java
- JavaScript
- TypeScript
- PHP
- Protocol Buffers
- Ruby
- Rust

We are working on adding support for more languages. If you would like to help contribute to this effort, you can add support for your language in the open source [Tree-sitter](https://github.com/tree-sitter) parser ecosystem, upon which symbol search is based.

### Content qualifier

Expand All @@ -168,7 +257,6 @@ content:README.md

This query would only match files containing the term `README.md`, rather than matching files named `README.md`.


### Is qualifier

To filter based on document properties, you can use the `is:` qualifier. At this time, the only value supported in this qualifier is `archived`, which restricts the search to archived repositories. For example:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Using GitHub Code Search (beta)
intro: ''
intro: 'You can use suggestions, completions and saved searches in the upgraded search interface to quickly find what you are looking for across {% data variables.product.prodname_dotcom_the_website %}.'
allowTitleToDifferFromFilename: true
versions:
feature: github-code-search
Expand All @@ -18,43 +18,44 @@ topics:

## About using GitHub Code Search (beta)

Upon getting access to the GitHub Code Search beta, GitHub will index any repositories you own and any repositories in organizations you are a member of, whether public, private, or internal. This means that you can search across all of your repositories, in addition to the public repositories on GitHub.com that have already been indexed. Only users with permission to view your code on GitHub.com will be able to see your code in search results.
Upon getting access to the GitHub Code Search beta, GitHub will index any repositories you own and any repositories in organizations you are a member of, whether public, private, or internal. This means that you can search across all of your repositories, in addition to the public repositories on {% data variables.product.prodname_dotcom_the_website %} that have already been indexed. Only users with permission to view your code on {% data variables.product.prodname_dotcom_the_website %} will be able to see your code in search results.

Not all code is indexed, and you can currently only search the default branches of repositories. For more information on known limitations, see "[About GitHub Code Search (beta)](/search-github/github-code-search/about-github-code-search#limitations)."

The GitHub Code Search beta is integrated within the new code view beta. {% data reusables.search.code-view-link %}

## Using the search bar

You can use the existing search bar on the top navigation of GitHub.com. Using suggestions, completions, and saved searches, you can quickly find what you are looking for, often without having to fully type a query or view the search results page.
On top of the new code search engine, the GitHub Code Search (beta) includes an upgraded search interface on {% data variables.product.prodname_dotcom_the_website %}. Using suggestions, completions, and saved searches, you can quickly find what you are looking for, often without having to fully type a query or view the search results page.

For more information about the search syntax of GitHub Code Search (beta), see "[Understanding GitHub Code Search (beta) syntax](/search-github/github-code-search/understanding-github-code-search-syntax)."

Note that the syntax and qualifiers for searching for non-code content, such as issues, users, and discussions, works the same as it did before, in the classic search. For more information on the classic search, see "[About search on GitHub](/articles/about-search-on-github) and "[Searching on GitHub](/search-github/searching-on-github/index.md)."
{% data reusables.search.non-code-search-explanation %}

1. In the top navigation of GitHub.com, click the search bar.
2. Under the search bar, you will see a list of suggestions organized by category, including recent searches and suggested repositories, teams, and projects that you have access to. You can also see a list of saved searches that you have created. For more information on saved searches, see [Using the search results view](#creating-and-managing-saved-searches).
1. In the top navigation of {% data variables.product.prodname_dotcom_the_website %}, click the search bar.
1. Under the search bar, you will see a list of suggestions organized by category, including recent searches and suggested repositories, teams, and projects that you have access to. You can also see a list of saved searches that you have created. For more information on saved searches, see "[Creating and managing saved searches](#creating-and-managing-saved-searches)."

If you click on any of the specific suggestions, you will be taken directly to the page for that suggestion (for example, the repository or project page). If you click on a recent or saved search, you will be taken to the search results view for that search query.
3. Once you start typing a search query, you will see a list of completions and suggestions that match your query. You can click on those to jump to a specific location. As you type more qualifiers, you will see more specific suggestions, such as code files.
4. After typing your query, you can also hit Enter to be taken to the full search results view. For more information, see [Using the search results view](#using-the-search-results-view).
If you click on any of the specific suggestions, you will be taken directly to the page for that suggestion (for example, the repository or project page). If you click on a recent or saved search, you will be taken to the search results view for that search query.

1. Once you start typing a search query, you will see a list of completions and suggestions that match your query. You can click on those to jump to a specific location. As you type more qualifiers, you will see more specific suggestions, such as code files you can jump to directly.
1. After typing your query, you can also hit Enter to be taken to the full search results view. For more information, see "[Using the search results view](#using-the-search-results-view)."

## Creating and managing saved searches

1. In the top navigation of GitHub.com, click the search bar and start typing a search query (or any word).
1. In the top navigation of {% data variables.product.prodname_dotcom_the_website %}, click the search bar and start typing a search query (or any letter).
2. Under the search bar, the "Saved searches" section should now show. Click **Create saved search**.
3. In the pop-up window, fill out the name you want for your query and the query that you want to save. Click **Create saved search**.

If you click again on the search bar, you can now see your saved search in the "Saved searches" section under the search bar. Clicking on a saved search will add the query to the search bar and filter the suggestions accordingly.

To edit a saved search, select the search bar and, in the "Saved searches" section, click the pencil icon to the right of the saved search. To delete a saved search, click the trash can icon to the right of the saved search.
If you click again on the search bar, you can now see your saved search in the "Saved searches" section under the search bar. Clicking on a saved search entry will add the query to the search bar and filter the suggestions accordingly.
- To edit a saved search, in the "Saved searches" section, click {% octicon "pencil" aria-label="The pencil icon" %} to the right of the saved search.
- To delete a saved search, click {% octicon "trash" aria-label="The trash icon" %} to the right of the saved search.

## Using the search results view

This search results view already existed for the current search on GitHub, and the functionality for most search types, except code, is the same. With GitHub Code Search beta enabled, the search results page has a redesigned UI and includes filters that are part of the new code search engine, such as path and symbol filters.

To construct a search query and view, sort, and filter results using a visual interface, you can use {% data variables.search.search_page_url %} or {% data variables.search.advanced_url %}.
To construct a search query and view, sort, and filter results using a visual interface, you can use {% data variables.search.search_page_url %} or {% data variables.search.advanced_url %}.

If you hit Enter after typing a search query in the search bar, you will also be taken to the search results view.
If you hit Enter after typing a search query in the search bar, you will also be taken to the search results view.

On the search results view, you can navigate between different types of search results, including code, issues, pull request, repositories, and more. You can also view and click on filters and sort results.
2 changes: 1 addition & 1 deletion content/search-github/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ featuredLinks:
- /search-github/searching-on-github/searching-for-repositories
- /search-github/searching-on-github/searching-commits
popular:
- /search-github/github-code-search/about-github-code-search
- /search-github/getting-started-with-searching-on-github/understanding-the-search-syntax
- /search-github/searching-on-github/searching-users
- /search-github/searching-on-github/finding-files-on-github
- /search-github/getting-started-with-searching-on-github/sorting-search-results
- /search-github/github-code-search/about-github-code-search
guideCards:
- /search-github/searching-on-github/searching-in-forks
- /search-github/searching-on-github/searching-topics
Expand Down
Loading

0 comments on commit c977fb4

Please sign in to comment.