2 min read

Yesterday, Google launched the beta version of its Cloud Source Repositories. Claiming to provide its users with a better search experience, Google Cloud Source Repositories is a Git-based source code repository built on Google Cloud.

The Cloud Source Repositories introduce a powerful code search feature, which uses the document index and retrieval methods similar to Google Search.

These Cloud source repositories can pose a major comeback for Google after Google Code, began shutting down in 2015. This could be a very strategic move for Google, as many coders have been looking for an alternative to GitHub, after its acquisition by Microsoft.

How does Google code search work?

Code search in Cloud Source Repositories optimizes the indexing, algorithms, and result types for searching code. On submitting a query, the query is sent to a root machine and sharded to hundreds of secondary machines. The machines look for matches by file names, classes, functions and other symbols, and matches the context and namespace of the symbols.

A single query can search across thousands of different repositories. Cloud Source Repositories also has a semantic understanding of the code. For Java, JavaScript, Go, C++, Python, TypeScript and Proto files, the tools will also return information on whether the match is a class, method, enum or field.

Solution to common code search challenges

#1 To execute searches across all the code at ones’ company

If a company has repositories storing different versions of the code, executing searches across all the code is exhaustive and ttime-consuming While using Cloud Source Repositories, the default branches of all repositories are always indexed and up-to-date. Hence, searching across all the code is faster.

#2 To search for code that performs a common operation

Cloud Source Repositories enables users to perform quick searches. Users can also save time by discovering and using the existing solution while avoiding bugs in their code.

#3 If a developer cannot remember the right way to use a common code component

Developers can enter a query and search across all of their company’s code for examples of how the common piece of code has been used successfully by other developers.

#4 Issues with production application

 If a developer encounters a specific error message to the server logs that reads ‘User ID 123 not found in PaymentDatabase’, they can perform a regular expression search for ‘User ID .* not found in PaymentDatabase’ and instantly find the location in the code where this error was triggered.

All repositories that are either mirrored or added to Cloud Source Repositories can be searched in a single query. Cloud Source Repositories has a limited free tier that supports projects up to 50GB with a maximum of 5 users.

You can read more about Cloud Source Repositories in the official documentation.

Read Next

Google announces Flutter Release Preview 2 with extended support for Cupertino themed controls and more!

Google to allegedly launch a new Smart home device

Google’s prototype Chinese search engine ‘Dragonfly’ reportedly links searches to phone numbers

Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.