GitHub is making significant improvements to its code searching experience and has launched a technology preview for an early peek.
The current search index covers more than five million of the most popular public repositories. In addition, developers can also search any private repositories they have access to.
GitHub recommends trying five search functions to see how they could improve your workflow:
- Try a simple search and see how the smart ranking and code-optimised index helps you to find exactly what you’re looking for.
- Search for an exact string, with support for substring matches and special characters, or use regular expressions (enclosed in / separators).
- Scope your searches with org: or repo: qualifiers, with auto-completion suggestions in the search box.
- Refine your results using filters like language:, path:, extension:, and Boolean operators (OR, NOT). Search for definitions of a symbol with symbol:.
- Get to grips with additional features like the directory tree view, symbol information for the active scope, jump-to-definition, select-to-search, and more!
A complete list of supported syntax is available here. You can also press ? on any page to view available keyboard shortcuts.
The current search interface is separate from the main GitHub experience. Once the company has incorporated any feedback and believes that it’s ready for wider adoption then it will be integrated with the main site.
There are some current noteworthy limitations. First off, the feature only supports searching content on the default branch and not all repo content is indexed.
The current limitations on indexed code are:
- Vendored and generated code is excluded (as determined by Enry)
- Empty files and files over 350 KiB are excluded
- Only UTF-8 encoded files are included
- Very large repositories may not be indexed
Search results are limited to 10 pages, which should be enough for most searches but is worth noting. The company intends to provide support for retrieving all search results through an API in the future.
GitHub makes no guarantees during the preview about how quickly the index is updated after a new push but says it’s normally searchable within a few minutes.
Developers can sign up for the code search preview here.
(Image Credit: GitHub)
Looking to revamp your digital transformation strategy? Learn more about Digital Transformation Week taking place on 11-12 May 2022 and discover key strategies for making your digital efforts a success.