Search
After you have installed and started running TeamCity, it collects the information on builds, tests and so on and indexes it. You can search builds by build number, tag, build configuration name and other different parameters specifying one or several keywords. You can also search for builds by text in build logs, and, since TeamCity 9.1, by the external id of a build configuration.
Search Query
In TeamCity you can search for builds using the Lucene query syntax; however, a TeamCity search query has two major differences described below.
To narrow your search and get more precise results, use the available search fields - indexed parameters of each build. For complete list of available search fields (keywords), refer to this section of the page.
Differences from Lucene Syntax
When using a search query in TeamCity, mind the following major differences from the Lucene native syntax:
By default, TeamCity uses the "
AND"
operator in a query. That is, if you type in the following query: "failed @agent123", then you will get a list of all builds that have the keyword "failed" in any of its search fields, and were run on the build agent named "agent123".By default, TeamCity uses the "prefix search", not the exact matching like Lucene. For example, if you search for "c:main", TeamCity will find all builds of the build configuration whose name starts with the "main" string.
Performing Fuzzy Search
You also have a possibility to perform fuzzy search using the tilde ("~") symbol at the end of a single word term to search for items with similar spelling.
Boolean Operators and Wildcards Support
You can combine multiple terms with Boolean operators to create more complex search queries. In TeamCity, you can use AND, "+", OR, NOT and "-".
When using Boolean operators, type them ALL CAPS.
AND (same as a plus sign). All words that are linked by the "AND" are included in the search results. This operator is used by default.
NOT (same as minus sign in front of a query word). Exclude a word or phrase from search results.
OR operator helps you to fetch the search terms that contain either of the terms you specify in the search field.
TeamCity also supports the "*" and "?" wildcards in a query. It is not recommended to use the asterisk ( *) at the beginning of the search term as it may require a significant amount of time for TeamCity to search its database. For example, the *onfiguration
search term is incorrect.
Complete List of Available Search Fields, Shortcuts, and Keywords
Search Fields
When using search keywords, use the following query syntax:
Search Field | Shortcut | Description | Example |
---|---|---|---|
agent | Find all builds that were run on the specified agent. |
| |
build | Find all builds that include changes with the specified string. |
| |
buildLog | Find all builds that include certain text in build logs. It is disabled by default. |
| |
changes | Find all builds that include changes with the specified string. |
| |
committers | Find all build that include changes committed by the specified developer. |
| |
configuration | c | Find all builds from the specified build configuration. |
|
file_revision | Find all builds that contain a file with the specified revision. |
| |
files | Find all builds that include files with the specified file name. |
| |
labels | l | Find all builds that include changes with the specified VCS label. |
|
pin_comment | Find all builds that were pinned and have the specified word (string) in the pin comment. |
| |
project | p | Find all builds from the specified project. |
|
revision | Find all builds that include changes with the specified revision (e.g., you can search for builds with a specific changelist from Perforce, or revision number in Subversion, etc.). |
| |
stamp | Find all builds that started at the specified time (search by timestamp). |
| |
status | Find all builds with the specified text in the build status text. |
| |
tags | t | Find all builds with the specified tag. |
|
tests | Find all builds that include specified tests. |
| |
triggerer | Find all builds that were triggered by the specified user. |
| |
vcs | Find builds that have the specified VCS. |
|
Shortcuts
In addition to above mentioned search fields, you can the following shortcuts in your query:
Note that when you use these shortcuts, do not insert the colon after it. That is, the query syntax is as follows: <shortcut><value to search>
Shortcut | Description | Example |
---|---|---|
# | Search for the specified build number. |
|
@ | Find all builds that were run on the specified agent. |
|
Using Double-Colon
You can use the double-colon sign (::
) to search for a project and/or build configuration by name:
pro::best
— search for builds of configurations with the names starting with "best", and in the projects with the names starting with "pro".mega::
— search for builds in all projects with names starting with "mega"::super
— search for builds of build configurations with names starting with "super"
"Magic" Keywords
TeamCity also provides "magic" keywords (see table below for the complete list ). These magic keywords are formed with the '$'
sign and a word itself. The word can be shortened up to one (first) syllable, that is, the $labeled
, $l
, and $lab
keywords will be equal in a query. For example, to search for pinned builds of the "Nightly build" configuration in the "Mega" project you can use any of the following queries:
configuration:nightly project:Mega $pinned
c:nigh p:mega $pin
M::night $pin
Magic word | Description |
---|---|
$tagged | Search for builds with tags. For example, |
$pinned | Search for pinned builds. |
$labeled | Search for builds that have been labels in VCS. For example, to find labeled builds of the Main project you can use following queries: |
$commented | Search for builds that have been commented. |
$personal | Search for personal builds. For example, using |
Search by Build Log
By default, TeamCity does not search for builds by a certain text in build logs.
To enable search by the build logs, perform the following:
1. Set the tc.search.indexBuildLog=true
TeamCity internal property 2. Reset the search cache on the Administration| Server Administration| Diagnostics, Caches tab or manually delete files from < TeamCity Data Directory>\system\caches\search. Please note that you might have to restart the server to let it pick up the updated search cache. Since TeamCity 9.0.1 restart is not required.
After re-indexing, TeamCity will be able to perform searching by specified text in the build logs and will list the relevant builds.