Bitbucket Cloud での検索
To start searching in Bitbucket, select the search field in the top navigation bar. The keyboard shortcut to start a search from anywhere in Bitbucket is "/".
Search results in Bitbucket are code first and you can also use operators or modifiers to help you to refine search results. While you are searching, notice that you are provided with ways to refine your search, a list of recent searches, and a list of repositories that you may be searching for.
検索範囲
検索範囲は、検索場所によって変わります。
Search context/location | 検索範囲 |
|---|---|
ワークスペース | All repositories in a workspace accessible to a user |
リポジトリ | 個別のリポジトリおよびそれらのサブディレクトリ |
Access repository-level code search
To search for code within a specific repository, go to the repository, select the dropdown in the search field (it is set to Files by default), and then select Code from the dropdown menu.
フレーズ クエリ
フレーズ クエリを使用すると、特定の組み合わせで表示される複数の単語を検索できます。
To search for a phrase, enclose the words in double quotes. For example, to find files with instances of the word abstract followed by the word class, your query would look like this.
"abstract class"The same search query without the double quotes would return files that contain both abstract and class in any order. For example, a query for abstract class means that only files that contain both abstract and class are matched.
検索修飾子
修飾子を指定すると、検索結果を絞り込むことができます。
Use a modifier in the form
key:value.The modifier field name is case-sensitive,
REPO:myrepowill throw an error.You can combine multiple modifiers; they are combined with
ANDby default.
次の検索修飾子を利用できます。
修飾子 | クエリ例 | 結果 |
|---|---|---|
Note: You can also use |
| Matches files in
|
|
| パスが
|
|
Note: do not include the dot delimiter, i.e. | Matches files with the |
Note: You can also use |
| Matches C files with the |
Note: |
Note: the | Matches files from repository forks that contain the term
|
Project-level search coming back soon
We are working on implementing the project-level search modifiers that previously existed into the new search experience. Thanks for your patience.
パス修飾子
Code search can be restricted to only consider a particular path. For the purpose of search, file paths are split up into segments (parts separated by /) including directories and filenames. Matching is done on one or more segment and is case-insensitive.
There is no partial matching within a segment. This means path:mai will not match a file at src/main/java/Foo.java because the indexed term is main, not mai. Specifically for file names, path:foo will not match src/foo.java — the full filename including extension must be specified, e.g. path:foo.java.
クエリ例 | 結果 |
|---|---|
| Files with paths containing the segment |
| Files with paths containing the consecutive segments |
| Files which contain the term |
Wildcards for path and repository modifiers
The path: and repo: modifiers support the * and ? wildcards. When a wildcard is used, the pattern is matched against the full file path or repository slug as a single string, not against individual segments of the path or repository slug. * matches any sequence of characters including path separators, and ? matches exactly one character. Wildcard matching is case-sensitive.
クエリ例 | 結果 |
|---|---|
| Files inside a |
| Files inside a |
| Files named |
| Files named |
| Files in a single-character versioned directory such as |
| Files containing login in any repository whose name starts with |
| Files containing |
| Files containing |
| Files containing |
| Only the repository named exactly |
言語およびファイル拡張子の修飾子
Code search can be restricted to only consider a particular language or a particular file extension. For some languages, adding a language criteria is equivalent to specifying the file extension. For example, lang:go is equivalent to extension:go. For other languages, multiple file extensions are mapped to a single language. For example, the .hs and .lhs file extensions are used for the Haskell programming language, and will be matched when specifying lang:haskell.
ここで使用する 'language' は、リポジトリの言語設定には関係しません。
These are the languages recognized by code search:
ada, asp.net, assembly, c, c++, c#, clojure, cobol, cql, css, cython, fortran, go, groovy, haskell, html, java, javascript, js, json, kotlin, latex, less, lisp, markdown, mathematica, matlab, objective-c, ocaml, pascal, perl, php, plain, plsql, properties, python, r, ruby, rust, sas, scala, scss, shell, sieve, soy, sql, swift, typescript, ts, velocity, xml, yaml
検索演算子
Search operators can be used with modifiers to refine your search results.
Operators cannot be used alone or with search terms; they can only be used with modifiers.
See more on using multiple modifiers in the next section.
These are the search operators available:
演算子 | クエリ例 | 結果 |
|---|---|---|
|
| Returns files from the |
|
| Returns files from the |
|
| Returns files that contain |
|
| Shorthand for |
Examples of valid and invalid search syntax
Validity | クエリ | 結果 |
|---|---|---|
Not valid |
| Operators, such as |
Not valid |
| Operators, such as |
有効性 |
| Finds files that contain the terms |
有効性 |
| Finds files with the |
複数の修飾子を使用する
It’s not required to use an operator between modifiers: modifiers are implicitly combined with the AND operator. However, especially when using two modifiers of the same type, you may want to specify an operator like or between them.
For example, here is a query that would find files that 1) are from either repo:A or repo:B 2) have the .js extension 3) have test as part of their file path and 4) that contain the term search-term.
repo:A or repo:B extension:js path:test search-termNote: The example uses the or operator between repo:A and repo:B. Because all modifiers are combined with and by default, the query repo:A repo:B search-term would search for files that are simultaneously in repo A and repo B (which is not possible) and return no results.
Examples of valid and invalid search syntax:
Validity | クエリ | 結果 |
|---|---|---|
有効性 |
| Finds files with the |
有効性 |
|
|
有効性 |
|
|
有効性 |
|
|
有効性 |
|
|
Not valid |
| Looks for files with both the |
Operator precedence and grouping
When you use OR between two modifiers, it applies only to those two modifiers. The implicit AND still joins that pair to the rest of your query. So this query finds files in either the jira or confluence repository that are written in Go:
bitbucket repo:jira or repo:confluence lang:goTo combine more than one or, or to make the grouping explicit, use parentheses.
This query finds files with either the .js or .jsx extension, in either the jira or confluence repository, that contain MyComponent:
MyComponent (repo:jira or repo:confluence) (extension:js or extension:jsx)NOT and - negate the modifier or parenthesized group that immediately follows.
This query will exclude several repositories at once:
MyClass -(repo:jira or repo:confluence)Examples of valid and invalid usage of parentheses:
Validity | クエリ | 結果 |
|---|---|---|
有効性 |
| Finds files that are in the |
有効性 |
| Finds files with the |
有効性 |
Note: This is equivalent to writing | Finds files that are not in the |
⚠️ Valid, but not effective |
| Excludes only files that are in both |
Not valid |
Note: Inside parentheses you must use an explicit operator. | Invalid syntax error |
コード検索の考慮事項
検索の実行方法については、いくつかの考慮事項があります。
Search uses the default branch in a repository.
We index files smaller than 512 KB – you won't see search results from larger files.
Wildcard matching in search terms (e.g.
qu?ck buil*) is not supported.正規表現はクエリではサポートされません。
Case is not preserved, except in wildcard patterns for
path:andrepo:modifiers.There is no strict query length limit, though very long queries may result in degraded performance.
検索結果には、閲覧権限を持つコードのみが表示されます。
Search for files
Files can be found by searching their filename or a folder name from its path. See the examples in the table below.
クエリ | 結果 |
|---|---|
|
|
|
Note: This type of query will also return code results containing the same keywords. |
|
|
| Finds files named |
この内容はお役に立ちましたか?