BitBucket Code Aware Search

Today had to find some aspects from the code, but didn’t really remember the right repository, where the sample was.. We use BitBucket for code storage and suddenly I’ve found that they have a nice feature in their cloud interface: you can fast search for any text across all your repositories.

Image for post
Image for post

But the main feature here is that the search is not just simple INDEX, they added priorities to some terms so that you get more relevant results for the language you have used in that project.

Example:

For the term “hash” it shows:

Image for post
Image for post

And only after that things like:

Image for post
Image for post

Sure the more relevant is Class/Method definition in case of C# then some usage example.

How code search works in BitBucket Cloud

Search indices built using traditional text indexers will usually return the usage result first because it contains a higher number of exact matches for your search term. In code bases where the same class or function is used many times, developers are often left trawling through page after page of usage results trying to hunt down the definition.

We took a different approach: by boosting the definitions matching your search term, the result you want is likely to rank much higher (usually #1) in the search results. Our algorithm boosts definitions for a wide range of type categories including classes, functions, enums, structs, and interfaces. We prioritized building a code aware search scoped to team and user accounts over a global search functionality. This way, we hope to quickly give our users the relevant results they want instead of the hassle of checking out a repo locally and searching using an IDE.

Image for post
Image for post
Go, with the Flow

In case you are paranoidal about security you will find such an interesting record in your Audit Logs:

Image for post
Image for post
Some guy, who installed the addon in my profile!

Sure there is no problem in removing the addon from settings:

Image for post
Image for post

More in their official blog.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store