blob: 8a231fe72e1aa1ad930cc9275e6ade3fb3dc88bd [file] [log] [blame]
Shawn O. Pearce51d008d2010-07-16 18:34:31 -07001Gerrit Code Review - Searching Changes
2======================================
3
4Default Searches
5----------------
6
7Most basic searches can be viewed by clicking on a link along the top
8menu bar. The link will prefill the search box with a common search
9query, execute it, and present the results. If exactly one change
10matches the search, the change will be presented instead of a list.
11
12
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010013[options="header"]
14|=================================================
15|Description | Default Query
16|All > Open | status:open '(or is:open)'
17|All > Merged | status:merged
18|All > Abandoned | status:abandoned
Deniz Türkoglud6799b1d2012-05-10 11:20:56 -070019|My > Drafts | is:draft
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010020|My > Watched Changes | status:open is:watched
21|My > Starred Changes | is:starred
Deniz Türkoglud6799b1d2012-05-10 11:20:56 -070022|My > Draft Comments | has:draft
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010023|Open changes in Foo | status:open project:Foo
24|=================================================
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070025
26Basic Change Search
27-------------------
28
29Similar to many popular search engines on the web, just enter some
30text and let Gerrit figure out the meaning:
31
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010032[options="header"]
33|=============================================================
34|Description | Examples
35|Legacy numerical id | 15183
36|Full or abbreviated Change-Id | Ic0ff33
37|Full or abbreviated commit SHA-1 | d81b32ef
38|Email address | user@example.com
39|Approval requirement | CodeReview>=+2, Verified=1
40|=============================================================
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070041
42
43Search Operators
44----------------
45
46Operators act as restrictions on the search. As more operators
47are added to the same query string, they further restrict the
monica.dionisio7dfa0d22010-08-27 11:46:33 -030048returned results. Search can also be performed by typing only a
49text with no operator. It will try to match a project name by
50substring.
51
52E.g. Searching for just "gerrit is:starred" will try to match a
53project name by "gerrit" as substring.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070054
Shawn O. Pearce51e058f62010-07-19 10:30:37 -070055[[age]]
56age:'AGE'::
57+
58Amount of time that has expired since the change was last updated
59with a review comment or new patch set. The age must be specified
60to include a unit suffix, for example `age:2d`:
61+
62* s, sec, second, seconds
63* m, min, minute, minutes
64* h, hr, hour, hours
65* d, day, days
66* w, week, weeks (`1 week` is treated as `7 days`)
67* mon, month, months (`1 month` is treated as `30 days`)
68* y, year, years (`1 year` is treated as `365 days`)
69
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070070[[change]]
71change:'ID'::
72+
73Either a legacy numerical 'ID' such as 15183, or a newer style
74Change-Id that was scraped out of the commit message.
75
76[[owner]]
77owner:'USER'::
78+
Shawn O. Pearce068a0d82012-04-07 14:59:11 -070079Changes originally submitted by 'USER'. The special case of
80`owner:self` will find changes owned by the caller.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070081
Martin Fickbcb5b9b2011-01-13 13:16:20 -070082[[ownerin]]
83ownerin:'GROUP'::
84+
85Changes originally submitted by a user in 'GROUP'.
86
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070087[[reviewer]]
88reviewer:'USER'::
89+
Shawn O. Pearce068a0d82012-04-07 14:59:11 -070090Changes that have been, or need to be, reviewed by 'USER'. The
91special case of `reviewer:self` will find changes where the caller
92has been added as a reviewer.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070093
Martin Fickbcb5b9b2011-01-13 13:16:20 -070094[[reviewerin]]
95reviewerin:'GROUP'::
96+
97Changes that have been, or need to be, reviewed by a user in 'GROUP'.
98
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070099[[commit]]
100commit:'SHA1'::
101+
102Changes where 'SHA1' is one of the patch sets of the change.
103
104[[project]]
105project:'PROJECT'::
106+
Edwin Kempinf1acbb82011-09-15 12:49:42 +0200107Changes occurring in 'PROJECT'. If 'PROJECT' starts with `^` it
Magnus Bäcke5611832011-02-02 08:57:15 +0100108matches project names by regular expression. The
109link:http://www.brics.dk/automaton/[dk.brics.automaton
110library] is used for evaluation of such patterns.
111
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700112
113[[branch]]
114branch:'BRANCH'::
115+
Edwin Kempinad921cd2012-03-27 16:00:56 +0200116Changes for 'BRANCH'. The branch name is either the short name shown
117in the web interface or the full name of the destination branch with
118the traditional 'refs/heads/' prefix.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700119+
120If 'BRANCH' starts with `^` it matches branch names by regular
Magnus Bäcke5611832011-02-02 08:57:15 +0100121expression patterns. The
122link:http://www.brics.dk/automaton/[dk.brics.automaton
123library] is used for evaluation of such patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700124
125[[topic]]
126topic:'TOPIC'::
127+
128Changes whose designated topic at upload was 'TOPIC'. This is
129often combined with 'branch:' and 'project:' operators to select
130all related changes in a series.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700131+
132If 'TOPIC' starts with `^` it matches topic names by regular
Magnus Bäcke5611832011-02-02 08:57:15 +0100133expression patterns. The
134link:http://www.brics.dk/automaton/[dk.brics.automaton
135library] is used for evaluation of such patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700136
137[[ref]]
138ref:'REF'::
139+
140Changes where the destination branch is exactly the given 'REF'
141name. Since 'REF' is absolute from the top of the repository it
142must start with 'refs/'.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700143+
144If 'REF' starts with `^` it matches reference names by regular
Magnus Bäcke5611832011-02-02 08:57:15 +0100145expression patterns. The
146link:http://www.brics.dk/automaton/[dk.brics.automaton
147library] is used for evaluation of such patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700148
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100149[[tr,bug]]
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700150tr:'ID', bug:'ID'::
151+
David Pursehouse221d4f62012-06-08 17:38:08 +0900152Search for changes whose commit message contains 'ID' and matches
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700153one or more of the
154link:config-gerrit.html#trackingid[trackingid sections]
155in the server's configuration file. This is typically used to
156search for changes that fix a bug or defect by the issue tracking
157system's issue identifier.
158
159[[label]]
160label:'VALUE'::
161+
162Matches changes where the approval score 'VALUE' has been set during
163a review. See <<labels,labels>> below for more detail on the format
164of the argument.
165
monica.dionisio70a7ca02010-08-25 14:46:13 -0300166[[message]]
167message:'MESSAGE'::
168+
David Pursehouse221d4f62012-06-08 17:38:08 +0900169Changes that match 'MESSAGE' arbitrary string in the commit message body.
monica.dionisio70a7ca02010-08-25 14:46:13 -0300170
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700171[[file]]
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100172file:^'REGEX'::
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700173+
174Matches any change where REGEX matches a file that was affected
175by the change. The regular expression pattern must start with
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100176`^`. For example, to match all XML files use `file:^.*\.xml$`.
Magnus Bäcke5611832011-02-02 08:57:15 +0100177The link:http://www.brics.dk/automaton/[dk.brics.automaton
178library] is used for the evaluation of such patterns.
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200179+
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100180The `^` required at the beginning of the regular expression not only
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200181denotes a regular expression, but it also has the usual meaning of
182anchoring the match to the start of the string. To match all Java
183files, use `file:^.*\.java`.
184+
Edwin Kempincdb0e002011-09-08 14:23:30 +0200185The entire regular expression pattern, including the `^` character,
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200186should be double quoted when using more complex construction (like
187ones using a bracket expression). For example, to match all XML
188files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
Edwin Kempincdb0e002011-09-08 14:23:30 +0200189`file:"^name[1-3].xml"`.
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200190+
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700191Currently this operator is only available on a watched project
192and may not be used in the search bar.
193
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700194[[has]]
195has:draft::
196+
197True if there is a draft comment saved by the current user.
198
199has:star::
200+
201Same as 'is:starred', true if the change has been starred by the
202current user.
203
204[[is]]
205is:starred::
206+
207Same as 'has:star', true if the change has been starred by the
208current user.
209
210is:watched::
211+
212True if this change matches one of the current user's watch filters,
213and thus is likely to notify the user when it updates.
214
215is:reviewed::
216+
217True if there is at least one non-zero score on the change, in any
218approval category, by any user.
219
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700220is:owner::
221+
222True on any change where the current user is the change owner.
223Same as `owner:self`.
224
225is:reviewer::
226+
227True on any change where the current user is a reviewer.
228Same as `reviewer:self`.
229
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700230is:open::
231+
David Pursehouse221d4f62012-06-08 17:38:08 +0900232True if the change is either open or submitted, merge pending.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700233
Deniz Türkoglud6799b1d2012-05-10 11:20:56 -0700234is:draft::
235+
236True if the change is a draft.
237
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700238is:closed::
239+
240True if the change is either merged or abandoned.
241
242is:submitted, is:merged, is:abandoned::
243+
244Same as <<status,status:'STATE'>>.
245
246[[status]]
247status:open::
248+
David Pursehouse221d4f62012-06-08 17:38:08 +0900249True if the change state is either 'review in progress' or 'submitted,
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700250merge pending'.
251
252status:reviewed::
253+
254Same as 'is:reviewed', matches if there is at least one non-zero
255score on the change, in any approval category, by any user.
256
257status:submitted::
258+
259Change has been submitted, but is waiting for a dependency.
260
261status:closed::
262+
263True if the change is either 'merged' or 'abandoned'.
264
265status:merged::
266+
267Change has been merged into the branch.
268
269status:abandoned::
270+
Edwin Kempin4c903b82012-06-13 16:06:07 +0200271Change has been abandoned.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700272
273
274Boolean Operators
275-----------------
276
277Unless otherwise specified, operators are joined using the `AND`
278boolean operator, thereby restricting the search results.
279
280Parentheses can be used to force a particular precendence on complex
281operator expressions, otherwise OR has higher precendence than AND.
282
283Negation
284~~~~~~~~
285Any operator can be negated by prefixing it with `-`, for example
286`-is:starred` is the exact opposite of `is:starred` and will
287therefore return changes that are *not* starred by the current user.
288
289The operator `NOT` (in all caps) is a synonym.
290
291AND
292~~~
293The boolean operator `AND` (in all caps) can be used to join two
294other operators together. This results in a restriction of the
295results, returning only changes that match both operators.
296
297OR
298~~
299The boolean operator `OR` (in all caps) can be used to find changes
300that match either operator. This increases the nubmer of results
301that are returned, as more changes are considered.
302
303
304[[labels]]
305Labels
306------
David Pursehouse221d4f62012-06-08 17:38:08 +0900307Label operators can be used to match approval scores given during
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700308a code review. The specific set of supported labels depends on
309the server configuration, however `CodeReview` and `Verified`
310are the default labels provided out of the box.
311
312A label name is any of the following:
313
314* The category name. If the category name contains spaces,
315 it must be wrapped in double quotes. Example: `label:"Code Review"`.
316
317* The name, without spaces. This avoids needing to use double quotes
318 for the common category Code Review. Example: `label:CodeReview`.
319
320* The internal short name. Example: `label:CRVW`, or `label:VRIF`.
321
322* The one or two character abbreviation shown in the column header
323 of change list pages. Example: `label:R` or `label:V`.
324
325A label name must be followed by a score, or an operator and a score.
David Pursehouse221d4f62012-06-08 17:38:08 +0900326The easiest way to explain this is by example.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700327
328`label:CodeReview=2`::
329`label:CodeReview=+2`::
330`label:CodeReview+2`::
331+
Edwin Kempincdb0e002011-09-08 14:23:30 +0200332Matches changes where there is at least one +2 score for Code Review.
333The + prefix is optional for positive score values. If the + is used,
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700334the = operator is optional.
335
336`label:CodeReview=-2`::
337`label:CodeReview-2`::
338+
339Matches changes where there is at least one -2 score for Code Review.
340Because the negative sign is required, the = operator is optional.
341
342`label:CodeReview=1`::
343+
344Matches changes where there is at least one +1 score for Code Review.
345Scores of +2 are not matched, even though they are higher.
346
347`label:CodeReview>=1`::
348+
349Matches changes with either a +1, +2, or any higher score.
350
351`label:CodeReview<=-1`::
352+
353Matches changes with either a -1, -2, or any lower score.
354
355`is:open CodeReview+2 Verified+1 -Verified-1 -CodeReview-2`::
356+
357Matches changes that are ready to be submitted.
358
359`is:open (Verified-1 OR CodeReview-2)`::
360+
361Changes that are blocked from submission due to a blocking score.
362
363
364Magical Operators
365-----------------
366
367Most of these operators exist to support features of Gerrit Code
368Review, and are not meant to be accessed by the average end-user.
369However, they are recognized by the query parser, and may prove
370useful in limited contexts to administrators or power-users.
371
372visibleto:'USER-or-GROUP'::
373+
374Matches changes that are visible to 'USER' or to anyone who is a
375member of 'GROUP'. Here group names may be specified as either
376an internal group name, or if LDAP is being used, an external LDAP
377group name. The value may be wrapped in double quotes to include
378spaces or other special characters. For example, to match an LDAP
379group: `visibleto:"CN=Developers, DC=example, DC=com"`.
380+
381This operator may be useful to test access control rules, however a
382change can only be matched if both the current user and the supplied
383user or group can see it. This is due to the implicit 'is:visible'
384clause that is always added by the server.
385
386is:visible::
387+
388Magical internal flag to prove the current user has access to read
389the change. This flag is always added to any query.
390
391starredby:'USER'::
392+
Edwin Kempin8de47ac2011-02-28 10:30:46 +0100393Matches changes that have been starred by 'USER'.
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700394The special case `starredby:self` applies to the caller.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700395
396watchedby:'USER'::
397+
398Matches changes that 'USER' has configured watch filters for.
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700399The special case `watchedby:self` applies to the caller.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700400
401draftby:'USER'::
402+
David Pursehouse221d4f62012-06-08 17:38:08 +0900403Matches changes that 'USER' has left unpublished draft comments on.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700404Since the drafts are unpublished, it is not possible to see the
Shawn O. Pearce068a0d82012-04-07 14:59:11 -0700405draft text, or even how many drafts there are. The special case
406of `draftby:self` will find changes where the caller has created
407a draft comment.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700408
409limit:'CNT'::
410+
411Limit the returned results to no more than 'CNT' records. This is
412automatically set to the page size configured in the current user's
413preferences. Including it in a web query may lead to unpredictable
414results with regards to pagination.
415
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100416resume_sortkey:'KEY'::
Shawn O. Pearce14760b72010-07-19 09:44:46 -0700417+
418Positions the low level scan routine to start from 'KEY' and
419continue through changes from this point. This is most often used
420for paginating result sets. Including this in a web query may lead
421to unpredictable results.
422
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100423sortkey_after:'KEY', sortkey_before:'KEY'::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700424+
425Restart the low level scan routine from 'KEY'. This is automatically
426set by the pagination system as the user navigates through results
427of a query. Including either value in a web query may lead to
428unpredictable results.
429
430GERRIT
431------
432Part of link:index.html[Gerrit Code Review]