Basic Regex Queries
A plain query will match the content of a file.
client
This will match the term client
in any of the files in the index. This applies to queries that contain whitespace:
apache license
will match any file that contains the exact string apache license
. Non-exact, or fuzzy, matching is on the roadmap. These plain queries are also known as content:
queries.
bloop can also match code symbols. These include identifiers like class, function and variable names:
symbol:Error
A regex query returns files whose content matches a regex. Regex queries are enclosed by /
:
/class\s[a-z]/
bloop supports all UTF-8 expressions supported by Rust's regex crate.
Filters
bloop let's you narrow down search results with a set of search filters. These are repo:
, path:
and lang:
. For example, the query:
repo:BurntSushi/aho-corasick ErrorKind
will match the term ErrorKind
in any file in the aho-corasick
repo. Filters can be combined to construct highly-specific search queries:
repo:BurntSushi/aho-corasick path:src/error ErrorKind lang:Rust
will only match the term ErrorKind
in Rust files in the aho-corasick
repo whose paths contain the pattern src/error
. Note that the ordering of these filters is not important. These two queries are equivalent:
repo:BurntSushi/aho-corasick path:src/error ErrorKind
path:src/error ErrorKind repo:BurntSushi/aho-corasick
bloop queries can also match against repo names or file paths.
repo:rus
will return all repos whose name contains the term rus
(e.g. Rust), and
path:lint-docs
will return all files that contain the pattern lint-docs
in their path.
Any query term can be a regex:
repo:/BurntSushi.*/ /^Copyright\s\(c\)/
will return files in any BurntSushi
repo which match the regex /^Copyright\s\(c\)/
.
Precedence
How does bloop know what to return when repo:
, path:
and content:
queries are combined? Query terms have an order of precedence:
content/symbol
path
repo
A search will return the type associated with the highest precedence term in the query. For example:
repo:BurntSushi/aho-corasick path:src/error
will match file paths within the specific repo, whereas:
path:src/error ErrorKind
will match file content because the ErrorKind
term takes precedence.
Previous: Getting StartedNext: Code Studio