Instant Search query syntax¶
Instant Search is the full-text search over your source code, reached from the global search bar's
File Contents category (%). See Find things fast for the
search bar itself and the other categories; this page is the query language.
All searching is case insensitive.
What gets indexed¶
Instant Search reads an index built after parsing, updated incrementally as files change. Indexing runs in the background and doesn't block other work. The index spans all projects, so a new project over already-indexed code doesn't pay to index it again — but results are limited to the current project while one is open.
For C, C++, Java and Ada, code is split into terms following the language's own syntax and lexical rules. Other languages are split on whitespace and punctuation. So in this line:
foreach (i=1, i<10, i++)
foreach, i, 1 and 10 are each searchable terms.
Fields¶
Every term is filed under one of three fields. A bare query searches all three; a prefix restricts it to one.
| Query | Matches |
|---|---|
test |
test in any field |
string:test |
test only inside string literals |
identifier:test |
identifiers named test |
comment:test |
comments containing test |
Wildcards and fuzzy matching¶
| Query | Matches |
|---|---|
test* |
anything beginning with test |
te?t |
te, any single character, then t |
test*bug |
anything beginning with test and ending with bug |
test~ |
terms like test — a fuzzy match, so also best, quest |
Boolean operators¶
| Query | Matches |
|---|---|
test this |
test or this |
test OR bug |
same as test bug |
test AND bug |
both test and bug |
+test bug |
must contain test, may contain bug |
test this NOT that |
test this, excluding anything with that |
test this -that |
same as above |
(test this) AND that |
test or this, and also that |
Notes¶
The syntax is based on Lucene's query syntax, which is richer than the subset above — most Lucene constructs work.
If results look stale or wrong, the index rather than the query is usually at fault; see Search results are wrong or stale.