summaryrefslogtreecommitdiffstats
path: root/Documentation/user-search.txt
blob: 55f668e1d2127cceb56bb2ebc40452b29bed4122 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
= Gerrit Code Review - Searching Changes

== Default Searches

Most basic searches can be viewed by clicking on a link along the top
menu bar.  The link will prefill the search box with a common search
query, execute it, and present the results.

[options="header"]
|=================================================
|Description          | Default Query
|All > Open           | status:open '(or is:open)'
|All > Merged         | status:merged
|All > Abandoned      | status:abandoned
|My > Watched Changes | is:watched is:open
|My > Starred Changes | is:starred
|My > Draft Comments  | has:draft
|Open changes in Foo  | status:open project:Foo
|=================================================


== Basic Change Search

Similar to many popular search engines on the web, just enter some
text and let Gerrit figure out the meaning:

[options="header"]
|=============================================================
|Description                      | Examples
|Legacy numerical id              | 15183
|Full or abbreviated Change-Id    | Ic0ff33
|Full or abbreviated commit SHA-1 | d81b32ef
|Email address                    | user@example.com
|=============================================================

For change searches (i.e. those using a numerical id, Change-Id, or commit
SHA1), if the search results in a single change that change will be
presented instead of a list.

For more predictable results, use explicit search operators as described
in the following section.

[[search-operators]]
== Search Operators

Operators act as restrictions on the search.  As more operators
are added to the same query string, they further restrict the
returned results. Search can also be performed by typing only a
text with no operator, which will match against a variety of fields.

[[age]]
age:'AGE'::
+
Amount of time that has expired since the change was last updated
with a review comment or new patch set.  The age must be specified
to include a unit suffix, for example `age:2d`:
+
* s, sec, second, seconds
* m, min, minute, minutes
* h, hr, hour, hours
* d, day, days
* w, week, weeks (`1 week` is treated as `7 days`)
* mon, month, months (`1 month` is treated as `30 days`)
* y, year, years (`1 year` is treated as `365 days`)

[[assignee]]
assignee:'USER'::
+
Changes assigned to the given user.

[[before_until]]
before:'TIME'/until:'TIME'::
+
Changes modified before the given 'TIME', inclusive. Must be in the
format `2006-01-02[ 15:04:05[.890][ -0700]]`; omitting the time defaults
to 00:00:00 and omitting the timezone defaults to UTC.

[[after_since]]
after:'TIME'/since:'TIME'::
+
Changes modified after the given 'TIME', inclusive. Must be in the
format `2006-01-02[ 15:04:05[.890][ -0700]]`; omitting the time defaults
to 00:00:00 and omitting the timezone defaults to UTC.

[[change]]
change:'ID'::
+
Either a legacy numerical 'ID' such as 15183, or a newer style
Change-Id that was scraped out of the commit message.

[[conflicts]]
conflicts:'ID'::
+
Changes that conflict with change 'ID'. Change 'ID' can be specified
as a legacy numerical 'ID' such as 15183, or a newer style Change-Id
that was scraped out of the commit message.

[[destination]]
destination:'NAME'::
+
Changes which match the current user's destination named 'NAME'.
(see link:user-named-destinations.html[Named Destinations]).

[[owner]]
owner:'USER', o:'USER'::
+
Changes originally submitted by 'USER'. The special case of
`owner:self` will find changes owned by the caller.

[[ownerin]]
ownerin:'GROUP'::
+
Changes originally submitted by a user in 'GROUP'.

[[query]]
query:'NAME'::
+
Changes which match the current user's query named 'NAME'
(see link:user-named-queries.html[Named Queries]).

[[reviewer]]
reviewer:'USER', r:'USER'::
+
Changes that have been, or need to be, reviewed by 'USER'. The
special case of `reviewer:self` will find changes where the caller
has been added as a reviewer.

[[cc]]
cc:'USER'::
+
Changes that have the given user CC'ed on them. The special case of `cc:self`
will find changes where the caller has been CC'ed.

[[revertof]]
revertof:'ID'::
+
Changes that revert the change specified by the numeric 'ID'.

[[reviewerin]]
reviewerin:'GROUP'::
+
Changes that have been, or need to be, reviewed by a user in 'GROUP'.

[[commit]]
commit:'SHA1'::
+
Changes where 'SHA1' is one of the patch sets of the change.

[[project]]
project:'PROJECT', p:'PROJECT'::
+
Changes occurring in 'PROJECT'. If 'PROJECT' starts with `^` it
matches project names by regular expression.  The
link:http://www.brics.dk/automaton/[dk.brics.automaton
library] is used for evaluation of such patterns.

[[projects]]
projects:'PREFIX'::
+
Changes occurring in projects starting with 'PREFIX'.

[[parentproject]]
parentproject:'PROJECT'::
+
Changes occurring in 'PROJECT' or in one of the child projects of
'PROJECT'.

[[repository]]
repository:'REPOSITORY', repo:'REPOSITORY'::
+
Changes occurring in 'REPOSITORY'. If 'REPOSITORY' starts with `^` it
matches repository names by regular expression.  The
link:http://www.brics.dk/automaton/[dk.brics.automaton
library] is used for evaluation of such patterns.

[[repositories]]
repositories:'PREFIX', repos:'PREFIX'::
+
Changes occurring in repositories starting with 'PREFIX'.

[[parentrepository]]
parentrepository:'REPOSITORY', parentrepo:'REPOSITORY'::
+
Changes occurring in 'REPOSITORY' or in one of the child repositories of
'REPOSITORY'.

[[branch]]
branch:'BRANCH'::
+
Changes for 'BRANCH'.  The branch name is either the short name shown
in the web interface or the full name of the destination branch with
the traditional 'refs/heads/' prefix.
+
If 'BRANCH' starts with `^` it matches branch names by regular
expression patterns.  The
link:http://www.brics.dk/automaton/[dk.brics.automaton
library] is used for evaluation of such patterns.

[[intopic]]
intopic:'TOPIC'::
+
Changes whose designated topic contains 'TOPIC', using a full-text search.
+
If 'TOPIC' starts with `^` it matches topic names by regular
expression patterns.  The
link:http://www.brics.dk/automaton/[dk.brics.automaton
library] is used for evaluation of such patterns.

[[topic]]
topic:'TOPIC'::
+
Changes whose designated topic matches 'TOPIC' exactly.  This is
often combined with 'branch:' and 'project:' operators to select
all related changes in a series.

[[hashtag]]
hashtag:'HASHTAG'::
+
Changes whose link:intro-user.html#hashtags[hashtag] matches 'HASHTAG'.
The match is case-insensitive.

[[ref]]
ref:'REF'::
+
Changes where the destination branch is exactly the given 'REF'
name.  Since 'REF' is absolute from the top of the repository it
must start with 'refs/'.
+
If 'REF' starts with `^` it matches reference names by regular
expression patterns.  The
link:http://www.brics.dk/automaton/[dk.brics.automaton
library] is used for evaluation of such patterns.

[[tr,bug]]
tr:'ID', bug:'ID'::
+
Search for changes whose commit message contains 'ID' and matches
one or more of the
link:config-gerrit.html#trackingid[trackingid sections]
in the server's configuration file.  This is typically used to
search for changes that fix a bug or defect by the issue tracking
system's issue identifier.

[[label]]
label:'VALUE'::
+
Matches changes where the approval score 'VALUE' has been set during
a review.  See <<labels,labels>> below for more detail on the format
of the argument.

[[message]]
message:'MESSAGE'::
+
Changes that match 'MESSAGE' arbitrary string in the commit message body.

[[comment]]
comment:'TEXT'::
+
Changes that match 'TEXT' string in any comment left by a reviewer.

[[path]]
path:'PATH'::
+
Matches any change touching file at 'PATH'. By default exact path
matching is used, but regular expressions can be enabled by starting
with `^`.  For example, to match all XML files use `file:^.*\.xml$`.
The link:http://www.brics.dk/automaton/[dk.brics.automaton library]
is used for the evaluation of such patterns.
+
The `^` required at the beginning of the regular expression not only
denotes a regular expression, but it also has the usual meaning of
anchoring the match to the start of the string.  To match all Java
files, use `file:^.*\.java`.
+
The entire regular expression pattern, including the `^` character,
should be double quoted when using more complex construction (like
ones using a bracket expression). For example, to match all XML
files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
`file:"^name[1-3].xml"`.
+
More examples:
* `-file:^path/.*` - changes that do not modify files from `path/`,
* `file:{^~(path/.*)}` - changes that modify files not from `path/` (but may
contain files from `path/`).

[[file]]
file:'NAME', f:'NAME'::
+
Matches any change touching a file containing the path component
'NAME'.  For example a `file:src` will match changes that modify
files named `gerrit-server/src/main/java/Foo.java`. Name matching
is exact match, `file:Foo.java` finds any change touching a file
named exactly `Foo.java` and does not match `AbstractFoo.java`.
+
Regular expression matching can be enabled by starting the string
with `^`. In this mode `file:` is an alias of `path:` (see above).

[[star]]
star:'LABEL'::
+
Matches any change that was starred by the current user with the label
'LABEL'.
+
E.g. if changes that are not interesting are marked with an `ignore`
star, they could be filtered out by '-star:ignore'.
+
'star:star' is the same as 'has:star' and 'is:starred'.

[[has]]
has:draft::
+
True if there is a draft comment saved by the current user.

[[has-star]]
has:star::
+
Same as 'is:starred' and 'star:star', true if the change has been
starred by the current user with the default label.

[[has-stars]]
has:stars::
+
True if the change has been starred by the current user with any label.

has:edit::
+
True if the change has inline edit created by the current user.

has:unresolved::
+
True if the change has unresolved comments.

[[is]]
is:assigned::
+
True if the change has an assignee.

[[is-starred]]
is:starred::
+
Same as 'has:star', true if the change has been starred by the
current user with the default label.

is:unassigned::
+
True if the change does not have an assignee.

is:watched::
+
True if this change matches one of the current user's watch filters,
and thus is likely to notify the user when it updates.

is:reviewed::
+
True if any user has commented on the change more recently than the
last update (comment or patch set) from the change owner.

is:owner::
+
True on any change where the current user is the change owner.
Same as `owner:self`.

is:reviewer::
+
True on any change where the current user is a reviewer.
Same as `reviewer:self`.

is:cc::
+
True on any change where the current user is in CC.
Same as `cc:self`.

is:open, is:pending::
+
True if the change is open.

is:closed::
+
True if the change is either merged or abandoned.

is:merged, is:abandoned::
+
Same as <<status,status:'STATE'>>.

is:submittable::
+
True if the change is submittable according to the submit rules for
the project, for example if all necessary labels have been voted on.
+
This operator only takes into account one change at a time, not any
related changes, and does not guarantee that the submit button will
appear for matching changes. To check whether a submit button appears,
use the
link:rest-api-changes.html#get-revision-actions[Get Revision Actions]
API.
+
Equivalent to <<submittable,submittable:ok>>.

[[mergeable]]
is:mergeable::
+
True if the change has no merge conflicts and could be merged into its
destination branch.
+
Mergeability of abandoned changes is not computed. This operator will
not find any abandoned but mergeable changes.

[[ignored]]
is:ignored::
+
True if the change is ignored. Same as `star:ignore`.

[[private]]
is:private::
+
True if the change is private, ie. only visible to owner and its
reviewers.

[[workInProgress]]
is:wip::
+
True if the change is Work In Progress.

[[status]]
status:open, status:pending::
+
True if the change state is 'review in progress'.

status:reviewed::
+
Same as 'is:reviewed', matches if any user has commented on the change
more recently than the last update (comment or patch set) from the
change owner.

status:closed::
+
True if the change is either 'merged' or 'abandoned'.

status:merged::
+
Change has been merged into the branch.

status:abandoned::
+
Change has been abandoned.

[[size]]
added:'RELATION''LINES', deleted:'RELATION''LINES', delta/size:'RELATION''LINES'::
+
True if the number of lines added/deleted/changed satisfies the given relation
for the given number of lines.
+
For example, added:>50 will be true for any change which adds at least 50
lines.
+
Valid relations are >=, >, <=, <, or no relation, which will match if the
number of lines is exactly equal.

[[commentby]]
commentby:'USER'::
+
Changes containing a top-level or inline comment by 'USER'. The special
case of `commentby:self` will find changes where the caller has
commented.

[[from]]
from:'USER'::
+
Changes containing a top-level or inline comment by 'USER', or owned by
'USER'. Equivalent to `(owner:USER OR commentby:USER)`.

[[reviewedby]]
reviewedby:'USER'::
+
Changes where 'USER' has commented on the change more recently than the
last update (comment or patch set) from the change owner.

[[author]]
author:'AUTHOR'::
+
Changes where 'AUTHOR' is the author of the current patch set. 'AUTHOR' may be
the author's exact email address, or part of the name or email address.

[[committer]]
committer:'COMMITTER'::
+
Changes where 'COMMITTER' is the committer of the current patch set.
'COMMITTER' may be the committer's exact email address, or part of the name or
email address.

[[submittable]]
submittable:'SUBMIT_STATUS'::
+
Changes having the given submit record status after applying submit
rules. Valid statuses are in the `status` field of
link:rest-api-changes.html#submit-record[SubmitRecord]. This operator
only applies to the top-level status; individual label statuses can be
searched link:#labels[by label].

[[unresolved]]
unresolved:'RELATION''NUMBER'::
+
True if the number of unresolved comments satisfies the given relation for the given number.
+
For example, unresolved:>0 will be true for any change which has at least one unresolved
comment while unresolved:0 will be true for any change which has all comments resolved.
+
Valid relations are >=, >, <=, <, or no relation, which will match if the number of unresolved
comments is exactly equal.

== Argument Quoting

Operator values that are not bare words (roughly A-Z, a-z, 0-9, @,
hyphen, dot and underscore) must be quoted for the query parser.

Quoting is accepted as either double quotes
(e.g.  `message:"the value"`) or as matched
curly braces (e.g. `message:{the value}`).


== Boolean Operators

Unless otherwise specified, operators are joined using the `AND`
boolean operator, thereby restricting the search results.

Parentheses can be used to force a particular precedence on complex
operator expressions, otherwise OR has higher precedence than AND.

=== Negation
Any operator can be negated by prefixing it with `-`, for example
`-is:starred` is the exact opposite of `is:starred` and will
therefore return changes that are *not* starred by the current user.

The operator `NOT` (in all caps) is a synonym.

=== AND
The boolean operator `AND` (in all caps) can be used to join two
other operators together.  This results in a restriction of the
results, returning only changes that match both operators.

=== OR
The boolean operator `OR` (in all caps) can be used to find changes
that match either operator.  This increases the number of results
that are returned, as more changes are considered.


[[labels]]
== Labels
Label operators can be used to match approval scores given during
a code review.  The specific set of supported labels depends on
the server configuration, however the `Code-Review` label is provided
out of the box.

A label name is any of the following:

* The label name.  Example: `label:Code-Review`.

* The label name followed by a ',' followed by a reviewer id or a
  group id.  To make it clear whether a user or group is being looked
  for, precede the value by a user or group argument identifier
  ('user=' or 'group=').  If an LDAP group is being referenced make
  sure to use 'ldap/<groupname>'.

A label name must be followed by either a score with optional operator,
or a label status. The easiest way to explain this is by example.

First, some examples of scores with operators:

`label:Code-Review=2`::
`label:Code-Review=+2`::
`label:Code-Review+2`::
+
Matches changes where there is at least one +2 score for Code-Review.
The + prefix is optional for positive score values.  If the + is used,
the = operator is optional.

`label:Code-Review=-2`::
`label:Code-Review-2`::
+
Matches changes where there is at least one -2 score for Code-Review.
Because the negative sign is required, the = operator is optional.

`label:Code-Review=1`::
+
Matches changes where there is at least one +1 score for Code-Review.
Scores of +2 are not matched, even though they are higher.

`label:Code-Review>=1`::
+
Matches changes with either a +1, +2, or any higher score.
+
Instead of a numeric vote, you can provide a label status corresponding
to one of the fields in the
link:rest-api-changes.html#submit-record[SubmitRecord] REST API entity.

`label:Non-Author-Code-Review=need`::
+
Matches changes where the submit rules indicate that a label named
`Non-Author-Code-Review` is needed. (See the
link:prolog-cookbook.html#NonAuthorCodeReview[Prolog Cookbook] for how
this label can be configured.)

`label:Code-Review=+2,aname`::
`label:Code-Review=ok,aname`::
+
Matches changes with a +2 code review where the reviewer or group is aname.

`label:Code-Review=2,user=jsmith`::
+
Matches changes with a +2 code review where the reviewer is jsmith.

`label:Code-Review=+2,user=owner`::
`label:Code-Review=ok,user=owner`::
`label:Code-Review=+2,owner`::
`label:Code-Review=ok,owner`::
+
The special "owner" parameter corresponds to the change owner.  Matches
all changes that have a +2 vote from the change owner.

`label:Code-Review=+1,group=ldap/linux.workflow`::
+
Matches changes with a +1 code review where the reviewer is in the
ldap/linux.workflow group.

`label:Code-Review<=-1`::
+
Matches changes with either a -1, -2, or any lower score.

`is:open label:Code-Review+2 label:Verified+1 NOT label:Verified-1 NOT label:Code-Review-2`::
`is:open label:Code-Review=ok label:Verified=ok`::
+
Matches changes that are ready to be submitted according to one common
label configuration. (For a more general check, use
link:#submittable[submittable:ok].)

`is:open (label:Verified-1 OR label:Code-Review-2)`::
`is:open (label:Verified=reject OR label:Code-Review=reject)`::
+
Changes that are blocked from submission due to a blocking score.

== Magical Operators

Most of these operators exist to support features of Gerrit Code
Review, and are not meant to be accessed by the average end-user.
However, they are recognized by the query parser, and may prove
useful in limited contexts to administrators or power-users.

visibleto:'USER-or-GROUP'::
+
Matches changes that are visible to 'USER' or to anyone who is a
member of 'GROUP'.  Here group names may be specified as either
an internal group name, or if LDAP is being used, an external LDAP
group name.  The value may be wrapped in double quotes to include
spaces or other special characters.  For example, to match an LDAP
group: `visibleto:"CN=Developers, DC=example, DC=com"`.
+
This operator may be useful to test access control rules, however a
change can only be matched if both the current user and the supplied
user or group can see it.  This is due to the implicit 'is:visible'
clause that is always added by the server.

is:visible::
+
Magical internal flag to prove the current user has access to read
the change.  This flag is always added to any query.

starredby:'USER'::
+
Matches changes that have been starred by 'USER' with the default label.
The special case `starredby:self` applies to the caller.

watchedby:'USER'::
+
Matches changes that 'USER' has configured watch filters for.
The special case `watchedby:self` applies to the caller.

draftby:'USER'::
+
Matches changes that 'USER' has left unpublished draft comments on.
Since the drafts are unpublished, it is not possible to see the
draft text, or even how many drafts there are. The special case
of `draftby:self` will find changes where the caller has created
a draft comment.

[[limit]]
limit:'CNT'::
+
Limit the returned results to no more than 'CNT' records.  This is
automatically set to the page size configured in the current user's
preferences.  Including it in a web query may lead to unpredictable
results with regards to pagination.

GERRIT
------
Part of link:index.html[Gerrit Code Review]

SEARCHBOX
---------