wiki:TracQuery

Version 2 (modified by trac, 16 years ago) (diff)

--

Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, used to display lists of tickets meeting a specified set of criteria.

To configure and execute a custom query, switch to the View Tickets module from the navigation bar, and select the Custom Query link.

Filters

When you first go to the query page the default filters will display all open tickets, or if you're logged in it will display open tickets assigned to you. Current filters can be removed by clicking the button to the right with the minus sign on the label. New filters are added from the pulldown list in the bottom-right corner of the filters box. Filters with either a text box or a pulldown menu of options can be added multiple times to perform an or of the criteria.

You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.

Once you've edited your filters click the Update button to refresh your results.

Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the Next Ticket or Previous Ticket links just below the main menu bar, or click the Back to Query link to return to the query page.

You can safely edit any of the tickets and continue to navigate through the results using the Next/Previous/Back to Query links after saving your results. When you return to the query any tickets which was edited will be displayed with italicized text. If one of the tickets was edited such that it no longer matches the query criteria the text will also be greyed. Lastly, if a new ticket matching the query critera has been created, it will be shown in bold.

The query results can be refreshed and cleared of these status indicators by clicking the Update button again.

Saving Queries

While Trac does not yet allow saving a named query and somehow making it available in a navigable list, you can save references to queries in Wiki content, as described below.

You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page.

[query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]

Which is displayed as:

Active tickets against 1.0

This uses a very simple query language to specify the criteria (see Query Language).

Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading ? character:

[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]

Which is displayed as:

Assigned tickets by owner

Using the [[TicketQuery]] Macro

The [[TicketQuery]] macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.

Example:

[[TicketQuery(version=1.0|2.0&resolution=duplicate)]]

This is displayed as:

#127
dependencies need to allow inclusion of variant
#354
dependencies rebuilt unnecessarily
#398
mysql 3.23.55 PortFile
#498
patch to upgrade mysql dport from 3.23.52 to last production release 4.0.12
#594
devel/jikespg 1.3 port
#601
New port wmaker
#612
mysql update
#622
freetype should be updated to latest version, diff inline
#634
can't mix and match distfiles and cvs fetch
#733
viewcvs broken
#736
add xslt variant to php4 dport
#743
Not possible to list installed ports
#746
Python 2.3 Portfile
#752
Nmap version needs updating to 3.3
#787
change of ownership for postfix
#825
libxml2
#916
graphics/fontconfig doesn't build due to URL changes
#1030
glib2 needs gettext... listed as a dependency but not retrieved or installed
#1088
qpopper does not work on Panther
#1112
abiword creates symlinks outside of destroot
#1134
UPDATE: php4-4.3.2 - fix for postgres & apache variants
#1203
arts fails to install with a clean "sudo port install kdebase3" but installs fine on its own
#1207
X11 Variant of emacs fails to run under Mac OS 10.3.1
#1213
koffice fails to compile (10.2.8 with gcc 3.3)
#1216
BUG: glut 3.7 doesn't compile
#1230
kdenetwork3 build failure
#1231
kdeutils3 build failure
#1259
BUG: kdebase3-3.1.2/rev3 not respecting ${prefix}
#1291
"Xft2" package should require "fontconfig"
#1309
atk port won't install unless glib2 has already been installed
#1319
popt build fails with undefined symbols
#1355
Installation of gnumeric fails
#1373
kdebase3 lib problem / Darwin 7
#1396
gnome-panel needs libxml2
#1471
DP not following dependency information correctly (was: apr-util doesn't install db4's dependencies?)
#1494
NEW: blinkentools-2.6
#1559
koffice fails during configuration
#1587
pango build fails
#1593
BUG: gnome-desktop failed dependency - pango compile fails
#1605
koffice-1.2.90 configure failure
#1620
Please port rlwrap
#1638
kdebase3 fails to compile
#1664
NEW: firebird + few problem (install pkg)
#1702
UPDATE: lftp-3.0.0
#1707
NEW: sisc-1.8.7
#1792
UPDATE: spambnc-20040421
#1793
UPDATE: spambnc-20040421
#1794
UPDATE: spambnc-20040421
#1795
UPDATE: spambnc-20040421
#1865
NEW: libfwbuilder-1.0.2
#2009
KOffice doesn't install
#2043
"Timing" problem with preinstall actions?
#2059
uprev ettercap to NG-0.7.0
#2070
freetype won't build on 7.2.1 x86
#2078
gettext and gnupg cannot be installed together
#2085
BUG: kdelibs-3.1.2
#2168
NEW: DarwinPortVersion-1.0
#2175
racoon does not compile
#2192
update gnupg port to latest version.
#2219
unrar build fails on 10.3.5/gcc-3.3
#2234
glib2 build fails with undefined symbol wcslen
#2295
port list output doing funky things when piped
#2332
Possible race condition creating postgresql user
#2337
BUG: XFree86
#2391
fix location of initscript for sysutils/smartmontools
#2409
maybe delete or re-fetch files if checksum is incorrect
#2447
Scrollkeeper fails to build
#2471
BUG: ocaml fails on OpenDarwin/x86
#2491
BUG: dsniff 2.3
#2502
UPDATE xpdf
#2522
NEW: firefox-1.0
#2652
imapfilter port
#2675
BUG: mutt +imap-headercache fails
#2773
BUG: fortune -m does not work
#2844
BUG: fondu is installed without man pages
#2968
NEW: firefox
#2986
UPDATE: README.it
#3012
BUG: fortune fails to install on Tiger due to dependancy on libcompat which fails to compile
#3040
BUG: gimp2 doesn't configure on 10.4
#3044
RFC: gnome-games does not include aislerot
#3050
BUG: mysql4 install on tiger (OS 10.4) fails with errors
#3058
BUG: gtk2 - ports which depend on gtk fail to build
#3085
port generated gv pkg files overwrite system components in etc on install
#3086
UPDATE: perforce
#3091
port deps does not support variants
#3097
teTeX install puts supposedly system-wide fmt files under home directory
#3135
libsdl_mixer does not build with gcc 4.0
#3151
mutt-devel does not compile (parse error with wc-functions)
#3153
port -dv install libcompat fails with compile error
#3154
port -dv install fortune fails due to libcompat compile error
#3155
mysql 4 points toward non-existant file
#3156
netpbm build failure on Tiger
#3166
Error building qt3 on Tiger
#3167
BUG: port and libsigc++
#3178
BUG: gnuplot-4.0.0
#3196
NEW: freeciv 2.0.1
#3201
py-scipy fails to build on tiger
#3210
RFC: py-pyqt3 needs to depend on py-sip +qt3-mac
#3214
audiofile doesn't build
#3229
xmms doesn't compile
#3271
ettercap-ng 0.7.1 does not make properly on MacOS X 10.4 Darwinports 1.001
#3326
cyrus-sasl2 fails to compile with gcc 4.0
#3378
NEW: Portfile for pgAdmin3
#3440
libsdl_image won't build on Tiger
#3453
py-game does not install font, mixer, sndarray modules
#3597
gnome-vfs 2.10.1 crashed using Xcode 2.1
#3617
NEW :dialog-1.0
#3698
BUG: cyberduck 2.3.3_1 installed damaged executable
#3728
error building audiofile-0.2.6
#3775
hellanzb - Please verify and add to DP
#3842
PHP5/Libcrypt linking issues
#3880
NEW: firefox-1.0.4
#3928
UPDATE: rrdtool-1.0.49 -> 1.2.10
#3954
ettercap-ng still doesn't build correctly
#3955
Fail to build 1.011
#3987
BUG: apache2 won't start with php4
#4038
NEW: esdl-0.95.0630
#4065
mailsync installation fails
#4066
'port upgrade -a' should have an option to work recursively
#4200
Missing dvips in teTeX
#4314
patch.args do not support being overwritten inside variants
#4434
-t doesn't always get all the pipe data and/or sometimes deadlocks
#4452
python/py-py2app 0.2 update
#4466
UPDATE latest fondu with man pages
#4525
Compile problems.
#4597
Dia 0.94 does not install
#4650
gawk build error
#4666
gimp2 / gimp-print
#4704
port search fails on some port names
#4792
gnome-vfs fails to buld on Tiger as a dependency to planner
#4818
BUG: can't compile FFMpeg
#4896
freetds fails build on OSX 10.4 Tiger
#4955
honeyd fails to install on Tiger
#4965
gnome-vfs fails to build
#4995
no avr-libc port
#5026
[Port Abandoned]: unixODBC
#5034
libgnomeui build problem after 1.1 update
#5091
port install gnome breaks on gnome-vfs
#5106
gnome-vfs 2.12.0_0 fails to build
#5302
update to correct variant server and startup script bugs
#5372
BUG: Upgrade try to activate old openssl
#5434
BUG: fontconfig
#5466
PORT REQUEST: Hylafax
#5470
UPDATE: bump gnome-python to a new version 2.12.1
#5510
BUG: gnome-vfs 2.12.0 fails to build
#5537
BUG: libgnomeprint fails on staging.
#5543
BUG: KDE will not build, says qt not compatable with kdelibs (both installed during build)
#5549
RFE: please bump ruby to version 1.8.3
#5595
BUG: librsvg install should update $prefix/etc/gtk-2.0/gdk-pixbuf.loaders
#5741
graphics/graphviz needs ruby dependency
#5945
NEW: py-libdnet 1.10
#5958
Update xorg Portfile for Tiger
#6117
BUG: Extension building problems with Python distutils
#6131
BUG: dependency of libgnomeui gnome-keyring not resolved
#6173
graphiz does not build
#6244
libgnomeui seems to be missing dependencies (pango or gnome-keyring)
#6346
fortune install failed due to missing data base
#6349
emacs (+carbon) completion problem
#6370
RFE: Ruby 1.8.4 now available
#6533
BUG: libsdl-1.2.9 fails on 10.3 if Xcode 1.5/QuickTime 7.0.4
#7026
eel build fails
#7028
libiconv conflicts with the platform version producing many warnings
#7043
eel depends on the world, but has no dependents. why do I need it?
#7061
scrollkeeper not listed as a dependency for Planner
#7119
NEW: mozart-1.3.1
#7159
bad checksums in fortune port for some libraries
#7192
New version of the less utility is available (textproc/less)
#7229
Upgrades libtheora from 1.0 alpha 3 to 1.0 alpha 5
#7230
Upgrades libvorbis from 1.1.0 to 1.1.1
#7271
BUG: upgrade libsdl 1.2.8_3 < 1.2.9_1 and libsdl_mixer 1.2.6_3 < 1.2.6_4 fail
#7524
UPDATE: p5-class-accessor to version 0.22
#7730
UPDATE: gnupg-1.4.2.2
#7807
id3lib tar.gz isn't downloaded
#8343
BUG: clisp crashes (version 2.38_1)
#9837
slib-guile won't install

Just like the query: wiki links, the parameter of this macro expects a query string formatted according to the rules of the simple ticket query language.

A more compact representation without the ticket summaries is also available:

[[TicketQuery(version=1.0|2.0&resolution=duplicate, compact)]]

This is displayed as:

#127, #354, #398, #498, #594, #601, #612, #622, #634, #733, #736, #743, #746, #752, #787, #825, #916, #1030, #1088, #1112, #1134, #1203, #1207, #1213, #1216, #1230, #1231, #1259, #1291, #1309, #1319, #1355, #1373, #1396, #1471, #1494, #1559, #1587, #1593, #1605, #1620, #1638, #1664, #1702, #1707, #1792, #1793, #1794, #1795, #1865, #2009, #2043, #2059, #2070, #2078, #2085, #2168, #2175, #2192, #2219, #2234, #2295, #2332, #2337, #2391, #2409, #2447, #2471, #2491, #2502, #2522, #2652, #2675, #2773, #2844, #2968, #2986, #3012, #3040, #3044, #3050, #3058, #3085, #3086, #3091, #3097, #3135, #3151, #3153, #3154, #3155, #3156, #3166, #3167, #3178, #3196, #3201, #3210, #3214, #3229, #3271, #3326, #3378, #3440, #3453, #3597, #3617, #3698, #3728, #3775, #3842, #3880, #3928, #3954, #3955, #3987, #4038, #4065, #4066, #4200, #4314, #4434, #4452, #4466, #4525, #4597, #4650, #4666, #4704, #4792, #4818, #4896, #4955, #4965, #4995, #5026, #5034, #5091, #5106, #5302, #5372, #5434, #5466, #5470, #5510, #5537, #5543, #5549, #5595, #5741, #5945, #5958, #6117, #6131, #6173, #6244, #6346, #6349, #6370, #6533, #7026, #7028, #7043, #7061, #7119, #7159, #7192, #7229, #7230, #7271, #7524, #7730, #7807, #8343, #9837

Query Language

query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Basically, the filters are separate by ampersands (&). Each filter then consists of the ticket field name, an operator, and one or more values. More than one value are separated by a pipe (|), meaning that the filter matches any of the values.

The available operators are:

= the field content exactly matches the one of the values
~= the field content contains one or more of the values
^= the field content starts with one of the values
$= the field content ends with one of the values

All of these operators can also be negated:

!= the field content matches none of the values
!~= the field content does not contain any of the values
!^= the field content does not start with any of the values
!$= the field content does not end with any of the values

See also: TracTickets, TracReports, TracGuide