検索
Bitbucket で検索を開始するには、サイドバーの Bitbucket アイコンの下にある虫眼鏡アイコンをクリックしてから、1 つの単語またはフレーズ全体 (二重引用符で囲む) を入力します。
The keyboard shortcut to start a search from anywhere in Bitbucket is " /
". Search terms can match the file path, filename, or any content within the file.
Search results in Bitbucket are code aware, which means your search results are ranked so that function and type definitions will display before other results. You can also use operators or modifiers to help you to refine search results.
検索範囲
検索範囲は、検索場所によって変わります。
検索コンテキスト | 検索範囲 |
---|---|
アカウント | ユーザーやチームが所有している、またはアクセス可能なすべてのリポジトリ |
リポジトリ | 個別のリポジトリおよびそれらのサブディレクトリ |
自身のアクセス権に関連付けられていない公開リポジトリで検索するには、そのリポジトリに移動し、そこで検索します。
File or path search
Files can be found just by searching their filename or parts of the path. Using the path
in your search only supports exact matches of path segments, but you can search using parts of the filename without a modifier. See the examples in the table below.
クエリ | 結果 |
---|---|
package.json |
Finds files named package.json |
package lock json |
Finds files that include package , lock , and json , such as package-lock.json |
package.json path:test |
Finds files named package.json with a path that contains test |
MyClass |
Finds files names MyClass.java and MyClassTest.java |
フレーズ クエリ
フレーズ クエリを使用すると、特定の組み合わせで表示される複数の単語を検索できます。
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
(or part of a word), your query would look like this.
"abstract class"
This query would also find instances such as " abstract(class
".
The same search query without the double quotes would return files that contain both abstract
and class
in any order.
検索演算子
検索演算子を使用して検索結果を絞り込むことができます。
- 演算子はすべて大文字にする必要があります。
- 演算子を単独で使用することはできません。必ず検索語句と一緒に使用する必要があります。
- You cannot use AND in your search query; multiple search terms are implicitly combined. For example, a query for
bitbucket jira
means that only files that contain bothbitbucket
andcloud
are matched.
次の検索演算子を利用できます。
演算子
|
クエリ例
|
結果
|
---|---|---|
なし | bitbucket jira |
Returns files that contain the terms bitbucket and jira , in any order |
NOT |
bitbucket NOT jira |
Returns files that contain bitbucket but don't contain jira |
- |
bitbucket -jira |
Used before a term; returns files that contain bitbucket but don't contain jira |
有効 () および無効 (
) な検索構文の例:
有効性 | クエリ | 結果 |
---|---|---|
![]() |
MyClass AND MyComponent NOT "YourClass" |
AND is not valid syntax; search terms are implicitly combined |
![]() |
NOT "YourClass" |
Operators cannot be used alone; you must specify a search term to match before what to exclude |
![]() |
MyClass MyComponent NOT "YourClass" |
Finds files that contain the terms MyClass and MyComponent but does not contain YourClass |
検索修飾子
修飾子を指定すると、検索結果を絞り込むことができます。
- Use a modifier in the form
key:value
. - 複数の修飾子を組み合わせることができます。以降の「複数の修飾子を使用する」セクションを参照してください。
- Modifiers can be negated using the
NOT
operator – see the section search operators above.
次の検索修飾子を利用できます。
修飾子
|
クエリ例
|
結果
|
---|---|---|
repo:<リポジトリの短縮名> <単語> |
repo:myrepo myClass |
Matches files in Wildcards are not supported in repository names Only the default branch of the repository is searched |
project:<プロジェクト キー> <単語> |
project:MYPROJ jira |
Matches files in the project with key MYPROJ that contain the term jira |
path:<directory|filename> <term> |
path:src MyClass |
Files with paths matching src which contain the term MyClass |
ext:<ファイル拡張子> <単語> |
ext:lhs jira |
Matches Haskell files with the |
lang:<言語> <単語> |
lang:c jira |
Matches C files with the |
パス修飾子
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.
クエリ例 | 結果 |
---|---|
path:src MyClass |
Files with paths matching src which contain the term MyClass |
path:/src MyClass |
Files with paths starting with src which contain the term MyClass |
path:src/main MyClass |
Files with paths matching src/main which contain the term MyClass |
path:src/*/module MyClass |
Files with paths matching src then anything then module which contain the term MyClass |
path:styles/*.css class |
Files with paths matching styles with the extension css which contain the term class . Note that there can be any number of other segments between styles and the filename |
MyClass NOT path:src |
Files which contain the term MyClass with paths that do not match src |
言語およびファイル拡張子の修飾子
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:java
is equivalent to ext:java
. For other languages, multiple file extensions are mapped to a single language. For example, the .hs
, .lhs
and .hs-boot
file extensions are used for the Haskell programming language, and will be matched when specifying lang:haskell
.
ここで使用する 'language' は、リポジトリの言語設定には関係しません。
複数の修飾子を使用する
修飾子はタイプに応じて暗黙的に組み合わせられるため、演算子と修飾子を一緒に使用する必要はありません。検索クエリで複数の検索修飾子を使用する場合は次の点に注意します。
- 同じ種類の検索修飾子は暗黙的に組み合わせられます。
- 異なる種類の検索修飾子は暗黙的に組み合わせられます。
- 検索修飾子は、検索式全体に適用されます。
For example, here is a query that would find files with either the .js
or the .jsx
extension, that are in either repo A
or repo B
, and that contain the phrase "search-term
".
repo:A repo:B ext:js ext:jsx search-term
有効 () および無効 (
) な検索構文の例:
有効性 | クエリ | 結果 |
---|---|---|
![]() |
ext:js project:myProject MyComponent |
Finds files with the js extension that are in the myProject project that contain the term MyComponent . |
![]() |
MyClass NOT repo:test |
Find all files that contain the term |
![]() |
MyClass -ext:java |
Find all files that contain the term |
![]() |
ext:js AND project:myProject MyComponent |
AND is not valid syntax; search terms are implicitly combined |
![]() |
ext:js NOT project:myProject MyComponent |
Finds files with the js extension in any project other than myProject that contain the term MyComponent |
![]() |
ext:js ext:java MyComponent |
Finds files with the js OR java extension that contain the term MyComponent |
コード検索の考慮事項
検索の実行方法については、いくつかの考慮事項があります。
- Search uses the main branch in a repo (usually the main branch will be
master
). - 320 KB 未満のファイルはインデックスされます – 大きなファイルからの検索結果は表示されません。
- Wildcard searches (e.g.
qu?ck buil*
) are not supported. - We strip the following characters from search terms:
!"#$%&'()*+,/;:<=>?@[\]^`{|}~-
- Regular expressions are not supported in queries.
- 大文字と小文字は区別されません (ただし、検索演算子はすべて大文字にする必要があります)。
- クエリには最大で 9 つの式 (例: 単語と演算子の組み合わせ) を設定できます。
- クエリの長さは、最大 250 文字です。
検索結果には、閲覧権限を持つコードのみが表示されます。