View all newsletters
Receive our newsletter - data, insights and analysis delivered to you
  1. Technology
  2. Cloud
September 20, 2018

Google Introduces Code Search capabilities into Google Cloud Platform

"Cloud Source Repositories can search across thousands of different repositories with a single query."

By CBR Staff Writer

Google Cloud Platform (GCP) users who store significant amounts of code within cloud source repositories will now be able to search their code base with a new user interface and semantic code search toolkit.

The new code search capabilities offered in Google’s Cloud Source Repositories (CSR) is designed using the same infrastructure technology as Google’s Search engine. The technology has been tweaked so that it is optimised for searching code with changes in the algorithms and indexing processes.

Russell Wolf Product Manager at GCP wrote in a blog that: “When you submit a query, that query is sent to a root machine and sharded to hundreds of leaf machines. It looks for matches by file names, classes, functions and other symbols, and matches the context and namespace of the symbols.”

“If regular expressions are specified in that query, our code search runs an optimized algorithm to quickly find potential matches for the regular expression. Then, it refines results against the full regular expression to find the actual matches.”

The search toolkit then refines the results in a comparison to a full regular expression to find matches, in order to give you extra context it will also show you what it thinks are relevant snippets of code in relation to your search.

Code Search: Use Cases

In a developer case study investigating how developers implement searches for code researchers learned that: “Code search is integrated in many development activities, from helping someone with a task to reviewing code, from finding an example to finding who was responsible for a change.”

“We also learn that a search session is generally just one to two minutes in length and involves just one to two queries and one to two file clicks.”

Content from our partners
Unlocking growth through hybrid cloud: 5 key takeaways
How businesses can safeguard themselves on the cyber frontline
How hackers’ tactics are evolving in an increasingly complex landscape

Users accessing the CSR to initiate code searches will only be shown the code that is within their access privileges. So enterprise will not have to set up additional permissions or security around who can search what.

Wolf gave the following example of how the tool might be used: “You want to search across all the code at your company, but there are a lot of repositories with only a few stored locally—which aren’t up-to-date with the versions on the server. Storing code locally isn’t a great option, and your computer’s search tools aren’t very powerful. When you’re using Cloud Source Repositories, the default branches of all repositories are always indexed and up-to-date. It’s simpler and faster to search across all the code you have access to for a particular file/class/function, rather than hunting for the code you have stored locally.”

See Also: A Lion That Eats Words, Roars Poetry, Is Powered by Google’s Neural Network

Mr Wolf also notes that: “Cloud Source Repositories can search across thousands of different repositories with a single query. You can search for either files or code within files in the default branch of your repository.”

“As you type in the search box, you’ll get suggestions for matching results (shown below). For Java, JavaScript, Go, C++, Python, TypeScript and Proto files, you’ll see result suggestions indicating whether the match is an entity such as a class, method, enum, or field,” Mr Wolf added.

Users can create a new empty repository or they can mirror their code from platforms such as Github and Bitbucket. Google customers already using Cloud Source Repositories will encounter a new landing page personalised to them.

Websites in our network
Select and enter your corporate email address Tech Monitor's research, insight and analysis examines the frontiers of digital transformation to help tech leaders navigate the future. Our Changelog newsletter delivers our best work to your inbox every week.
  • CIO
  • CTO
  • CISO
  • CSO
  • CFO
  • CDO
  • CEO
  • Architect Founder
  • MD
  • Director
  • Manager
  • Other
Visit our privacy policy for more information about our services, how New Statesman Media Group may use, process and share your personal data, including information on your rights in respect of your personal data and how you can unsubscribe from future marketing communications. Our services are intended for corporate subscribers and you warrant that the email address submitted is your corporate email address.
THANK YOU