I am pleased to share the news, which I hope will please some Habr's readers: in Bitbucket Server , the ability to search by code is about to appear. Just the other day, the release of the Early Access Program (EAP) was released.
I’ll start with a free translation of the appeal from a product manager published on the Atlassian blog :
How often this happened to you: you see an error message, but you do not know in which part of the code it occurs, or you know the name of the function, but not the repository, in the code of which it is defined. Many of you have asked for a code search in Bitbucket Server, and I am pleased to announce that your wait has come to an end. Today, we invite our users to try out the code search in Bitbucket Server through the Early Access Program (EAP). Now you can search and find the necessary code using the search string:
')How it works?
We understand that many teams have a huge amount of code. Therefore, we made it so that you can easily limit search results to a specific project or repository using search filters. In addition, you can search for the code in a given language (for example,lang:java
) or in files with a specific extension (for example,ext:css
).
The operatorsAND
,OR
andNOT
will help to refine the query, they are useful for further filtering the search results in the case when there are too many of them.What to do to start using?
Glad you asked! Here you can download the Bitbucket Server EAP distribution with support for code search, and step-by-step instructions prepared by us should help with launching and configuring. We would be grateful if you tell us about your impressions of the EAP distribution, your feedback is extremely important to us. By filling out this short and simple questionnaire , you will help us improve the search for you and other Bitbucket users for its official release.
We are working to bring you more opportunities soon. Have a good search!
Steve king
In a brief retelling, the installation instructions boil down to the following steps:
As you can see from the help pages and the contents of the distribution, Elasticsearch is used to store the index with which the search is performed . It, in turn, is based on the well-known Apache Lucene library.
In Bitbucket Server, search provides two modules: the first is engaged in indexing repositories, the second serves search queries from users. Indexing takes place constantly in the background. If you update Bitbucket Server, which already contains a number of repositories, the initial indexing may take some time, but as soon as it is completed, subsequent changes are processed very quickly. It is worth noting that the search is available immediately, but as long as the indexing is in progress, its results may be incomplete. In addition, in order to optimize performance, a small delay was introduced between the moment of repository change (for example, a new code commit) and the moment when this change is reflected in the search results. By default, this delay can reach 15 seconds.
The installation procedure, compared with previous versions of Bitbucket Server, has not changed: all configuration actions necessary for the search operation are performed automatically. At the same time, it is not necessary to use the built-in copy of Elasticsearch: if you wish, you can customize the desired configuration yourself.
The search has several limitations:
master
is in most repositories, although this is not the rule)qu?ck buil*
)The search query must contain at least one term, which can be a word or a quotation phrase.
Operators can be added to the query to refine the search. Here is their current list:
Operator | Request example | Value |
---|---|---|
AND | bitbucket AND server | Corresponds to files containing both the words "bitbucket" and "server" |
OR | bitbucket OR server | Corresponds to files containing at least one of the words "bitbucket" or "server" |
NOT | bitbucket NOT jira | Corresponds to files containing the word "bitbucket", but not containing the word "jira" |
- | bitbucket -jira | Used before term; matches files containing the word "bitbucket" but not containing the word "jira" |
( ) | bitbucket AND (server OR cloud) | Corresponds to files containing the word "bitbucket" and any of the words "server" or "cloud" |
A query can contain several terms, and by default, they are implicitly combined using the logical AND
operator. That is, a bitbucket server
request is equivalent to a bitbucket AND server
request.
Modifiers help limit your search. They are written in the :
format. If the query contains several modifiers, they are implicitly combined with the AND
operator and are applied to the entire expression. The following modifiers are currently supported:
repo:
or repository:<_>
- search in a specific repository. Requires the proj:
modifier to identify the project. For example, you can search for files in the bitbucket repository of the atlassian project that contain the word jira by any of the following search queries:
jira repo:bitbucket proj:atlassian
jira repository:bitbucket project:atlassian
jira repo:atlassian/bitbucket
proj:
or project:<_/_>
- search in all repositories of a specific project. For example, you can find files in the "atlassian" project containing the word "jira" using any of these search queries:jira proj:atlassian
jira project:atlassian
Search may be limited to languages and file extensions. For some languages, these two criteria are identical: for example, the lang:clojure
and ext:clj
will ext:clj
the same result. However, there are some languages to which several file extensions correspond: for example, the .hs
and .lhs
are used in Haskell, and files with any of these extensions will be included in the search results with the lang:haskell
modifier.
lang:
or language:<>
- search for files in a specific language. The language corresponds to a set of extensions. For example, the following queries will find files in the LaTeX format (that is, those with the extension .ltx
, .tex
or .text
) containing the word "jira":
jira lang:latex
jira language:latex
ext:
or extension:<_>
file extension:<_>
- search for files with a specific extension. For example, you can find files containing the word "jira" and having the extension .lhs
using any of these queries:jira ext:lhs
jira extension:lhs
Just in case, I note that the instructions on the following help pages will be finalized in the near future to make the installation, configuration, and use of Bitbucket Server search even better. Let me remind you that your comments on any aspects of using EAP release are warmly welcome .
For me, this news is especially pleasant and important because I am directly involved in the development of search. I will be glad to answer any questions and comments.
Source: https://habr.com/ru/post/280133/
All Articles