blob: 5f0f004b22b986b8b3ec5054bf5de45c2d10faf9 [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
19|My > Dafts | has:draft
20|My > Watched Changes | status:open is:watched
21|My > Starred Changes | is:starred
22|Open changes in Foo | status:open project:Foo
23|=================================================
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070024
25Basic Change Search
26-------------------
27
28Similar to many popular search engines on the web, just enter some
29text and let Gerrit figure out the meaning:
30
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +010031[options="header"]
32|=============================================================
33|Description | Examples
34|Legacy numerical id | 15183
35|Full or abbreviated Change-Id | Ic0ff33
36|Full or abbreviated commit SHA-1 | d81b32ef
37|Email address | user@example.com
38|Approval requirement | CodeReview>=+2, Verified=1
39|=============================================================
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070040
41
42Search Operators
43----------------
44
45Operators act as restrictions on the search. As more operators
46are added to the same query string, they further restrict the
47returned results.
48
Shawn O. Pearce51e058f62010-07-19 10:30:37 -070049[[age]]
50age:'AGE'::
51+
52Amount of time that has expired since the change was last updated
53with a review comment or new patch set. The age must be specified
54to include a unit suffix, for example `age:2d`:
55+
56* s, sec, second, seconds
57* m, min, minute, minutes
58* h, hr, hour, hours
59* d, day, days
60* w, week, weeks (`1 week` is treated as `7 days`)
61* mon, month, months (`1 month` is treated as `30 days`)
62* y, year, years (`1 year` is treated as `365 days`)
63
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070064[[change]]
65change:'ID'::
66+
67Either a legacy numerical 'ID' such as 15183, or a newer style
68Change-Id that was scraped out of the commit message.
69
70[[owner]]
71owner:'USER'::
72+
73Changes originally submitted by 'USER'.
74
75[[reviewer]]
76reviewer:'USER'::
77+
78Changes that have been, or need to be, reviewed by 'USER'.
79
80[[commit]]
81commit:'SHA1'::
82+
83Changes where 'SHA1' is one of the patch sets of the change.
84
85[[project]]
86project:'PROJECT'::
87+
Shawn O. Pearce082ed412010-08-28 12:38:32 -070088Changes occuring in 'PROJECT'. If 'PROJECT' starts with `^` it
89matches project names by regular expression.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -070090
91[[branch]]
92branch:'BRANCH'::
93+
94Changes for 'BRANCH'. The branch name is the short name shown
95in the web interface, without the traditional 'refs/heads/'
96prefix. This operator is a shorthand for 'refs:'. Searching for
97'branch:master' really means 'ref:refs/heads/master', and searching
98for 'branch:refs/heads/master' is the same as searching for
99'ref:refs/heads/refs/heads/master'.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700100+
101If 'BRANCH' starts with `^` it matches branch names by regular
102expression patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700103
104[[topic]]
105topic:'TOPIC'::
106+
107Changes whose designated topic at upload was 'TOPIC'. This is
108often combined with 'branch:' and 'project:' operators to select
109all related changes in a series.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700110+
111If 'TOPIC' starts with `^` it matches topic names by regular
112expression patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700113
114[[ref]]
115ref:'REF'::
116+
117Changes where the destination branch is exactly the given 'REF'
118name. Since 'REF' is absolute from the top of the repository it
119must start with 'refs/'.
Shawn O. Pearce082ed412010-08-28 12:38:32 -0700120+
121If 'REF' starts with `^` it matches reference names by regular
122expression patterns.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700123
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100124[[tr,bug]]
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700125tr:'ID', bug:'ID'::
126+
127Search for changes whose commit message contains 'ID' and matched
128one or more of the
129link:config-gerrit.html#trackingid[trackingid sections]
130in the server's configuration file. This is typically used to
131search for changes that fix a bug or defect by the issue tracking
132system's issue identifier.
133
134[[label]]
135label:'VALUE'::
136+
137Matches changes where the approval score 'VALUE' has been set during
138a review. See <<labels,labels>> below for more detail on the format
139of the argument.
140
monica.dionisio70a7ca02010-08-25 14:46:13 -0300141[[message]]
142message:'MESSAGE'::
143+
144Changes that matches 'MESSAGE' arbitrary string in body commit messages.
145
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700146[[file]]
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100147file:^'REGEX'::
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700148+
149Matches any change where REGEX matches a file that was affected
150by the change. The regular expression pattern must start with
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100151`^`. For example, to match all XML files use `file:^.*\.xml$`.
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200152+
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100153The `^` required at the beginning of the regular expression not only
rafael.rabelosilvaaa5bca72010-08-26 11:04:53 +0200154denotes a regular expression, but it also has the usual meaning of
155anchoring the match to the start of the string. To match all Java
156files, use `file:^.*\.java`.
157+
158The entire regular expression pattern, including the `\^` character,
159should be double quoted when using more complex construction (like
160ones using a bracket expression). For example, to match all XML
161files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
162`\file:"\^name[1-3].xml"`.
163+
Shawn O. Pearce50756b92010-07-19 17:58:25 -0700164Currently this operator is only available on a watched project
165and may not be used in the search bar.
166
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700167[[has]]
168has:draft::
169+
170True if there is a draft comment saved by the current user.
171
172has:star::
173+
174Same as 'is:starred', true if the change has been starred by the
175current user.
176
177[[is]]
178is:starred::
179+
180Same as 'has:star', true if the change has been starred by the
181current user.
182
183is:watched::
184+
185True if this change matches one of the current user's watch filters,
186and thus is likely to notify the user when it updates.
187
188is:reviewed::
189+
190True if there is at least one non-zero score on the change, in any
191approval category, by any user.
192
193is:open::
194+
195True if the change is other open or submitted, merge pending.
196
197is:closed::
198+
199True if the change is either merged or abandoned.
200
201is:submitted, is:merged, is:abandoned::
202+
203Same as <<status,status:'STATE'>>.
204
205[[status]]
206status:open::
207+
208True if the change state is other 'review in progress' or 'submitted,
209merge pending'.
210
211status:reviewed::
212+
213Same as 'is:reviewed', matches if there is at least one non-zero
214score on the change, in any approval category, by any user.
215
216status:submitted::
217+
218Change has been submitted, but is waiting for a dependency.
219
220status:closed::
221+
222True if the change is either 'merged' or 'abandoned'.
223
224status:merged::
225+
226Change has been merged into the branch.
227
228status:abandoned::
229+
230Change has been abandoned by the change owner, or administrator.
231
232
233Boolean Operators
234-----------------
235
236Unless otherwise specified, operators are joined using the `AND`
237boolean operator, thereby restricting the search results.
238
239Parentheses can be used to force a particular precendence on complex
240operator expressions, otherwise OR has higher precendence than AND.
241
242Negation
243~~~~~~~~
244Any operator can be negated by prefixing it with `-`, for example
245`-is:starred` is the exact opposite of `is:starred` and will
246therefore return changes that are *not* starred by the current user.
247
248The operator `NOT` (in all caps) is a synonym.
249
250AND
251~~~
252The boolean operator `AND` (in all caps) can be used to join two
253other operators together. This results in a restriction of the
254results, returning only changes that match both operators.
255
256OR
257~~
258The boolean operator `OR` (in all caps) can be used to find changes
259that match either operator. This increases the nubmer of results
260that are returned, as more changes are considered.
261
262
263[[labels]]
264Labels
265------
266Label operators can be used to match approval score given during
267a code review. The specific set of supported labels depends on
268the server configuration, however `CodeReview` and `Verified`
269are the default labels provided out of the box.
270
271A label name is any of the following:
272
273* The category name. If the category name contains spaces,
274 it must be wrapped in double quotes. Example: `label:"Code Review"`.
275
276* The name, without spaces. This avoids needing to use double quotes
277 for the common category Code Review. Example: `label:CodeReview`.
278
279* The internal short name. Example: `label:CRVW`, or `label:VRIF`.
280
281* The one or two character abbreviation shown in the column header
282 of change list pages. Example: `label:R` or `label:V`.
283
284A label name must be followed by a score, or an operator and a score.
285The easiest way to explain these are by example.
286
287`label:CodeReview=2`::
288`label:CodeReview=+2`::
289`label:CodeReview+2`::
290+
291Matches changes where there is at least one \+2 score for Code Review.
292The \+ prefix is optional for positive score values. If the + is used,
293the = operator is optional.
294
295`label:CodeReview=-2`::
296`label:CodeReview-2`::
297+
298Matches changes where there is at least one -2 score for Code Review.
299Because the negative sign is required, the = operator is optional.
300
301`label:CodeReview=1`::
302+
303Matches changes where there is at least one +1 score for Code Review.
304Scores of +2 are not matched, even though they are higher.
305
306`label:CodeReview>=1`::
307+
308Matches changes with either a +1, +2, or any higher score.
309
310`label:CodeReview<=-1`::
311+
312Matches changes with either a -1, -2, or any lower score.
313
314`is:open CodeReview+2 Verified+1 -Verified-1 -CodeReview-2`::
315+
316Matches changes that are ready to be submitted.
317
318`is:open (Verified-1 OR CodeReview-2)`::
319+
320Changes that are blocked from submission due to a blocking score.
321
322
323Magical Operators
324-----------------
325
326Most of these operators exist to support features of Gerrit Code
327Review, and are not meant to be accessed by the average end-user.
328However, they are recognized by the query parser, and may prove
329useful in limited contexts to administrators or power-users.
330
331visibleto:'USER-or-GROUP'::
332+
333Matches changes that are visible to 'USER' or to anyone who is a
334member of 'GROUP'. Here group names may be specified as either
335an internal group name, or if LDAP is being used, an external LDAP
336group name. The value may be wrapped in double quotes to include
337spaces or other special characters. For example, to match an LDAP
338group: `visibleto:"CN=Developers, DC=example, DC=com"`.
339+
340This operator may be useful to test access control rules, however a
341change can only be matched if both the current user and the supplied
342user or group can see it. This is due to the implicit 'is:visible'
343clause that is always added by the server.
344
345is:visible::
346+
347Magical internal flag to prove the current user has access to read
348the change. This flag is always added to any query.
349
350starredby:'USER'::
351+
Edwin Kempin8de47ac2011-02-28 10:30:46 +0100352Matches changes that have been starred by 'USER'.
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700353
354watchedby:'USER'::
355+
356Matches changes that 'USER' has configured watch filters for.
357
358draftby:'USER'::
359+
360Matches changes that 'USER' has left unpublished drafts on.
361Since the drafts are unpublished, it is not possible to see the
362draft text, or even how many drafts there are.
363
364limit:'CNT'::
365+
366Limit the returned results to no more than 'CNT' records. This is
367automatically set to the page size configured in the current user's
368preferences. Including it in a web query may lead to unpredictable
369results with regards to pagination.
370
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100371resume_sortkey:'KEY'::
Shawn O. Pearce14760b72010-07-19 09:44:46 -0700372+
373Positions the low level scan routine to start from 'KEY' and
374continue through changes from this point. This is most often used
375for paginating result sets. Including this in a web query may lead
376to unpredictable results.
377
Karsten Dambekalnsa7f72a22011-03-25 14:21:59 +0100378sortkey_after:'KEY', sortkey_before:'KEY'::
Shawn O. Pearce51d008d2010-07-16 18:34:31 -0700379+
380Restart the low level scan routine from 'KEY'. This is automatically
381set by the pagination system as the user navigates through results
382of a query. Including either value in a web query may lead to
383unpredictable results.
384
385GERRIT
386------
387Part of link:index.html[Gerrit Code Review]