TeamCity
 
You are viewing the documentation for an earlier version of TeamCity.

Search

Last modified: 20 April 2023

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 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:

  1. 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".

  2. 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:

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>

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

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 index

After re-indexing, TeamCity will be able to perform searching by specified text in the build logs and will list the relevant builds.

Resetting Search Index



The search uses an "index" cached on the disk. Only the data previously added to the index is searchable and appears in the search results. Typically, data updates (such as new builds) cause only incremental updates to the index. This means that when some indexing setting is changed and the cached index on the disk gets out of sync, the index needs to be reset to reindex all the builds anew.

To reset the cached search index, click " reset " for the "search" entry on the Administration | Server Administration | Diagnostics, Caches tab or manually delete files from< >\system\caches\search while the server is not running. After that, reindexing will start which is a resource-intensive operation on the server and can take hours (depending on the number and "size" of builds, as well as the server machine and database performance). You can monitor the progress in the UI on the Search page or in the server logs.