1
0
mirror of synced 2025-12-21 19:06:49 -05:00

Code search and code view GA (#36512)

Co-authored-by: Sophie <29382425+sophietheking@users.noreply.github.com>
Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com>
This commit is contained in:
Sarita Iyer
2023-05-08 09:56:43 -04:00
committed by GitHub
parent 02232dfecc
commit 18f42d939e
66 changed files with 233 additions and 282 deletions

View File

@@ -1,38 +1,24 @@
---
title: About GitHub Code Search (beta)
intro: 'You can search, navigate and understand code across GitHub with the new code search (beta).'
title: About GitHub Code Search
intro: 'You can search, navigate and understand code across {% data variables.product.prodname_dotcom %} with code search.'
allowTitleToDifferFromFilename: true
versions:
feature: github-code-search
feature: code-search-code-view
topics:
- GitHub search
---
{% note %}
## About {% data variables.product.prodname_dotcom %} code search
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
{% data variables.product.prodname_dotcom %} code search 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 {% data variables.product.prodname_dotcom %} using regular expressions, boolean operations, specialized qualifiers, and symbol search. For more information on the syntax of code search, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
{% data reusables.search.code-view-link %}
{% endnote %}
## About the new code search (beta)
The new 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 the new code search (beta), see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
On top of the new code search engine, the code search (beta) includes new features in the search interface on {% data variables.product.prodname_dotcom_the_website %}, such as suggestions, completions, and the ability to save your searches. The new search interface allows you to more quickly and easily find what you are looking for. For more information, see "[AUTOTITLE](/search-github/github-code-search/using-github-code-search)."
Code search is integrated with features in the search interface on {% data variables.product.prodname_dotcom_the_website %}, such as suggestions, completions, and the ability to save your searches. For more information, see "[AUTOTITLE](/search-github/github-code-search/using-github-code-search)."
{% data reusables.search.non-code-search-explanation %}
The new 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 %}
## Enabling and disabling the new code search and code view (beta)
{% data reusables.search.enabling-and-disabling-code-search-and-view-beta %}
## Limitations
We have indexed many public repositories for the new code search (beta), and continue to index more. 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.
We have indexed many public repositories for code search, and continue to index more. Additionally, the private repositories of {% data variables.product.prodname_dotcom%} users are indexed and searchable by those that already have access to those private repositories on {% data variables.product.prodname_dotcom_the_website %}. 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
@@ -43,10 +29,10 @@ The current limitations on indexed code are:
We currently only support searching for code on the default branch of a repository.
Results for any search with the new code search (beta) are restricted to 100 results (10 pages). Sorting is not supported for code search results at this time. This limitation only applies to searching code with the new code search (beta) and does not apply to other types of searches.
Results for any search with code search are restricted to 100 results (10 pages). Sorting is not supported for code search results at this time. This limitation only applies to searching code with the new code search and does not apply to other types of searches.
The new 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 "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax#symbol-qualifier)."
Code search 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 "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax#symbol-qualifier)."
## Feedback and support
You can view and share feedback about the new code search (beta) in our [discussion forum](https://github.com/orgs/community/discussions/categories/code-search-and-navigation).
You can view and share feedback about code search in our [discussion forum](https://github.com/orgs/community/discussions/categories/code-search-and-navigation).

View File

@@ -1,9 +1,9 @@
---
title: GitHub Code Search (beta)
title: GitHub Code Search
intro: 'You can use a wide range of syntax to search {% data variables.product.product_name %}. You can adjust the scope of your search, build and troubleshoot queries, and narrow down search results with qualifiers.'
allowTitleToDifferFromFilename: true
versions:
feature: github-code-search
feature: code-search-code-view
topics:
- GitHub search
children:
@@ -11,11 +11,3 @@ children:
- /using-github-code-search
- /understanding-github-code-search-syntax
---
{% note %}
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
{% data reusables.search.code-search-link %} {% data reusables.search.code-view-link %}
{% endnote %}

View File

@@ -1,26 +1,19 @@
---
title: Understanding GitHub Code Search (beta) syntax
title: Understanding GitHub Code Search syntax
shortTitle: Code search syntax
intro: 'You can build search queries for the results you want with specialized code qualifiers, regular expressions, and boolean operations.'
allowTitleToDifferFromFilename: true
versions:
feature: github-code-search
feature: code-search-code-view
topics:
- GitHub search
---
{% note %}
## About code search query structure
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
The search syntax in this article only applies to searching code with {% data variables.product.prodname_dotcom %} code search. {% data reusables.search.non-code-search-explanation %}
{% data reusables.search.code-search-link %} {% data reusables.search.code-view-link %}
{% endnote %}
## About the new code search (beta) query structure
The search syntax in this article only applies to searching code with the new code search (beta) enabled. {% data reusables.search.non-code-search-explanation %}
Search queries consist of search terms, comprising text you want to search for, and qualifiers, which narrow down the search.
Search queries consist of search terms, comprising text you want to search for, and qualifiers, which narrow down the search.
A bare term with no qualifiers will match either the content of a file or the file's path.
@@ -42,11 +35,11 @@ sparse index
The search results would include all documents containing both the terms `sparse` and `index`, in any order. As examples, it would match a file containing `SparseIndexVector`, a file with the phrase `index for sparse trees`, and even a file named `index.txt` that contains the term `sparse`.
Searching for multiple terms separated by whitespace is the equivalent to the search `hello AND world`. Other boolean operations, such as `hello OR world`, are also supported in the new code search (beta). For more information about boolean operations, see "[Using boolean operations](#using-boolean-operations)."
Searching for multiple terms separated by whitespace is the equivalent to the search `hello AND world`. Other boolean operations, such as `hello OR world`, are also supported. For more information about boolean operations, see "[Using boolean operations](#using-boolean-operations)."
The new code search (beta) also supports searching for an exact string, including whitespace. For more information, see "[Query for an exact match](#query-for-an-exact-match)."
Code search also supports searching for an exact string, including whitespace. For more information, see "[Query for an exact match](#query-for-an-exact-match)."
You can narrow your code search with specialized qualifiers, such as `repo:`, `language:` and `path:`. For more information on the qualifiers you can use in the new code search (beta), see "[Using qualifiers](#using-qualifiers)."
You can narrow your code search with specialized qualifiers, such as `repo:`, `language:` and `path:`. For more information on the qualifiers you can use in code search, see "[Using qualifiers](#using-qualifiers)."
You can also use regular expressions in your searches by surrounding the expression in slashes. For more information on using regular expressions, see "[Using regular expressions](#using-regular-expressions)."
@@ -72,7 +65,7 @@ path: git language: "protocol buffers"
## Using boolean operations
The new code search (beta) supports boolean expressions. You can use the operators `AND`, `OR`, and `NOT` to combine search terms.
Code search supports boolean expressions. You can use the operators `AND`, `OR`, and `NOT` to combine search terms.
By default, adjacent terms separated by whitespace are equivalent to using the `AND` operator. For example, the search query `sparse index` is the same as `sparse AND index`, meaning that the search results will include all documents containing both the terms `sparse` and `index`, in any order.
@@ -121,7 +114,7 @@ repo:github-linguist/linguist OR repo:tree-sitter/tree-sitter
{% note %}
**Note:** The new code search beta does not currently support regular expressions or partial matching for repository names, so you will have to type the entire repository name (including the user prefix) for the `repo:` qualifier to work.
**Note:** Code search does not currently support regular expressions or partial matching for repository names, so you will have to type the entire repository name (including the user prefix) for the `repo:` qualifier to work.
{% endnote %}
@@ -141,7 +134,7 @@ user:octocat
{% note %}
**Note:** The new code search beta does not currently support regular expressions or partial matching for organization or user names, so you will have to type the entire organization or user name for the qualifier to work.
**Note:** Code search does not currently support regular expressions or partial matching for organization or user names, so you will have to type the entire organization or user name for the qualifier to work.
{% endnote %}
@@ -279,7 +272,7 @@ log4j NOT is:fork
## Using regular expressions
The new code search (beta) supports regular expressions to search for patterns in your code. You can use regular expressions in bare search terms as well as within many qualifiers, by surrounding the regex in slashes.
Code search supports regular expressions to search for patterns in your code. You can use regular expressions in bare search terms as well as within many qualifiers, by surrounding the regex in slashes.
For example, to search for the regular expression `sparse.*index`, you would use:

View File

@@ -1,34 +1,24 @@
---
title: Using GitHub Code Search (beta)
title: Using GitHub Code Search
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
feature: code-search-code-view
topics:
- GitHub search
---
{% note %}
## About using {% data variables.product.prodname_dotcom%} code search
**Note:** {% data reusables.search.code-search-code-view-beta-note %}
{% data reusables.search.code-search-link %} {% data reusables.search.code-view-link %}
{% endnote %}
## About using the new code search (beta)
Upon getting access to the new 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. Forks are indexed and searchable in the same way as other repositories.
{% data variables.product.prodname_dotcom %} indexes repositories you own and 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. Forks are indexed and searchable in the same way as other repositories.
Not all code is indexed, and you can currently only search the default branches of repositories. For more information on known limitations, see "[AUTOTITLE](/search-github/github-code-search/about-github-code-search#limitations)."
The new code search beta is integrated within the new code view beta. {% data reusables.search.code-view-link %}
## Using the search bar
On top of the new code search engine, the 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.
You can search using the 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 the new code search (beta), see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
For more information about the search syntax of code search, see "[AUTOTITLE](/search-github/github-code-search/understanding-github-code-search-syntax)."
{% data reusables.search.non-code-search-explanation %}
@@ -56,8 +46,6 @@ For more information about the search syntax of the new code search (beta), see
## Using the search results view
The search results view already exists for the classic search on GitHub, and the functionality for most search types, except code, is the same. With the new code search beta enabled, the search results page has a redesigned UI and includes filters that are supported in the new code search engine, such as path and symbol filters.
To construct a search query, as well as view and filter results, using a visual interface, you can use the {% data variables.search.search_page_url %} or {% data variables.search.advanced_url %}. If you press 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 use filters.