wiki:TracQuery

Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, which can be used to display tickets that meet specified 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 filter will display tickets relevant to you:

  • If logged in then all open tickets, it will display open tickets assigned to you.
  • If not logged in but you have specified a name or email address in the preferences, then it will display all open tickets where your email (or name if email not defined) is in the CC list.
  • If not logged in and no name/email is defined in the preferences, then all open issues are displayed.

Current filters can be removed by clicking the button to the left with the minus sign on the label. New filters are added from the dropdown lists at the bottom corners of the filters box; 'And' conditions on the left, 'Or' conditions on the right. Filters with either a text box or a dropdown menu of options can be added multiple times to perform an Or on the criteria.

For text fields such as Keywords and CC the - operator can be used to negate a match and double quotes (since 1.2.1) can be used to match a phrase. For example, a contains match for word1 word2 -word3 "word4 word5" matches tickets containing word1 and word2, not word3 and word4 word5.

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.

After you have edited your filters, click the Update button to refresh your results.

Keyboard shortcuts are available for manipulating the checkbox filters:

  • Clicking on a filter row label toggles all checkboxes.
  • Pressing the modifier key while clicking on a filter row label inverts the state of all checkboxes.
  • Pressing the modifier key while clicking on a checkbox selects the checkbox and deselects all other checkboxes in the filter. Since 1.2.1 this also works for the Columns checkboxes.

The modifier key is platform and browser dependent. On Mac the modified key is Option/Alt or Command. On Linux the modifier key is Ctrl + Alt. Opera on Windows seems to use Ctrl + Alt, while Alt is effective for other Windows browsers.

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 were 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 criteria 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

Trac allows you to save the query as a named query accessible from the reports module. To save a query ensure that you have Updated the view and then click the Save query button displayed beneath the results. You can also save references to queries in Wiki content, as described below.

Note: one way to easily build queries like the ones below, you can build and test the queries in the Custom report module and when ready - click Save query. This will build the query string for you. All you need to do is remove the extra line breaks.

Note: you must have the REPORT_CREATE permission in order to save queries to the list of default reports. The Save query button will only appear if you are logged in as a user that has been granted this permission. If your account does not have permission to create reports, you can still use the methods below to save a query.

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

Customizing the table format

You can also customize the columns displayed in the table format (format=table) by using col=<field>. You can specify multiple fields and what order they are displayed in by placing pipes (|) between the columns:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

This is displayed as:

Results (1 - 3 of 13187)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#13640 fixed Transort Editor does not work on Slave Backend Klaas de Waal jksj461
#13639 fixed AV Subtitles disappear too quickly mspieth mspieth
#13637 Duplicate SQL error in database upgrade kensheldon
1 2 3 4 5 6 7 8 9 10 11

Full rows

In table format you can also have full rows by using rows=<field>:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

This is displayed as:

Results (1 - 3 of 13187)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#13640 fixed Transort Editor does not work on Slave Backend Klaas de Waal jksj461
Description

Attempting to delete a UK DVB-T2 transport on a slave backend fails with

2020-06-22 18:01:55.499970 E CardUtil?: Can't open DVB frontend (/dev/dvb/adapter0/frontend0) for /dev/dvb/adapter0/frontend0.

The slave backend was not running and a full scan of all channels worked fine, so the issue only involves the transport editor.

pi@PiSlave:~ $ mythtv-setup 
libEGL warning: DRI2: failed to authenticate
"Display: Requesting EGL for 'Mesa Project, 1.4'"
libEGL warning: DRI2: failed to authenticate
qt5ct: using qt5ct plugin
2020-06-22 17:59:42.805880 I  Setup Interrupt handler
2020-06-22 17:59:42.806037 I  Setup Terminated handler
2020-06-22 17:59:42.806069 I  Setup Segmentation fault handler
2020-06-22 17:59:42.806097 I  Setup Aborted handler
2020-06-22 17:59:42.806126 I  Setup Bus error handler
2020-06-22 17:59:42.806155 I  Setup Floating point exception handler
2020-06-22 17:59:42.806184 I  Setup Illegal instruction handler
2020-06-22 17:59:42.806231 I  Setup Real-time signal 0 handler
2020-06-22 17:59:42.806263 I  Setup Hangup handler
2020-06-22 17:59:42.806711 C  mythtv-setup version: fixes/31 [v31.0-40-gce23a0225f] www.mythtv.org
2020-06-22 17:59:42.806741 C  Qt version: compile: 5.11.3, runtime: 5.11.3
2020-06-22 17:59:42.806928 I  Raspbian GNU/Linux 10 (buster) (arm)
2020-06-22 17:59:42.806939 N  Enabled verbose msgs:  general
2020-06-22 17:59:42.807005 N  Setting Log Level to LOG_INFO
2020-06-22 17:59:42.817948 I  Added logging to the console
2020-06-22 17:59:42.975445 N  Using runtime prefix = /usr/local
2020-06-22 17:59:42.975470 N  Using configuration directory = /home/pi/.mythtv
2020-06-22 17:59:42.975620 I  Assumed character encoding: en_GB.UTF-8
2020-06-22 17:59:42.994432 I  Loading en_gb translation for module mythfrontend
2020-06-22 17:59:43.009060 I  Empty LocalHostName. This is typical.
2020-06-22 17:59:43.009102 I  Using a profile name of: 'PiSlave' (Usually the same as this host's name.)
2020-06-22 17:59:43.009384 I  Start up testing connections. DB 192.168.0.108, BE , attempt 0, status dbAwake, Delay: 2000
2020-06-22 17:59:43.557089 N  Setting QT default locale to en_GB
2020-06-22 17:59:43.557210 I  Current locale en_GB
2020-06-22 17:59:43.557578 N  Reading locale defaults from /usr/local/share/mythtv//locales/en_gb.xml
2020-06-22 17:59:43.602984 I  Display: Defaulting to primary screen (default)
2020-06-22 17:59:43.603219 I  Display: Using screen 'default' (Make: Unknown Model: Unknown)
2020-06-22 17:59:43.603387 I  Display: Geometry: 1920x1080+0+0 Size(Qt): 508mmx286mm
2020-06-22 17:59:43.619170 N  Display: Desktop video mode: 1920x1080 60.000Hz
2020-06-22 17:59:43.662056 I  Starting process manager
2020-06-22 17:59:43.662080 I  Starting process signal handler
2020-06-22 17:59:43.662478 I  Starting IO manager (read)
2020-06-22 17:59:43.662502 I  Starting IO manager (write)
2020-06-22 17:59:43.713645 I  ScreenSaverX11Private: DPMS is active.
2020-06-22 17:59:43.832612 E  PowerDBus: No UPower interface. Unable to monitor battery state
2020-06-22 17:59:43.869443 I  Power: On AC power
2020-06-22 17:59:43.869557 I  Power: Supported actions: Restart,Shutdown
2020-06-22 17:59:43.910856 I  Loading en_gb translation for module mythfrontend
2020-06-22 17:59:43.924211 E  LIRC: Failed to connect to Unix socket '/var/run/lirc/lircd'
			eno: No such file or directory (2)
2020-06-22 17:59:43.924381 I  No joystick configuration found, not enabling joystick control
2020-06-22 17:59:43.924400 I  UDPListener: Enabling
2020-06-22 17:59:43.933188 I  Binding to UDP 0.0.0.0:0
2020-06-22 17:59:43.936156 I  Binding to UDP [::]:0
2020-06-22 17:59:44.039227 I  Using Frameless Window
2020-06-22 17:59:44.039246 I  Using Full Screen Window
2020-06-22 17:59:44.056969 I  Display: Have main widget
2020-06-22 17:59:44.056991 I  Display: Have main window
2020-06-22 17:59:44.059114 I  Display: Defaulting to primary screen (default)
2020-06-22 17:59:44.065118 I  UI Screen Resolution: 1920 x 1080
QOpenGLFramebufferObject: Framebuffer incomplete attachment.
QOpenGLFramebufferObject: Framebuffer incomplete, missing attachment.
2020-06-22 17:59:44.368471 E  Failed to create framebuffer object
2020-06-22 17:59:44.368958 I  OpenGL: OpenGL vendor        : VMware, Inc.
2020-06-22 17:59:44.369000 I  OpenGL: OpenGL renderer      : llvmpipe (LLVM 9.0.1, 128 bits)
2020-06-22 17:59:44.369036 I  OpenGL: OpenGL version       : OpenGL ES 3.1 Mesa 19.3.2
2020-06-22 17:59:44.369095 I  OpenGL: Qt platform          : xcb
2020-06-22 17:59:44.369354 I  OpenGL: EGL display          : Yes
2020-06-22 17:59:44.369390 I  OpenGL: EGL images           : Yes
2020-06-22 17:59:44.369419 I  OpenGL: Qt OpenGL format     : OpenGLES 3.1
2020-06-22 17:59:44.369448 I  OpenGL: Qt OpenGL surface    : RGBA: 8880 Depth: 0 Stencil: 0
2020-06-22 17:59:44.369481 I  OpenGL: Max texture size     : 8192
2020-06-22 17:59:44.369514 I  OpenGL: Max texture units    : 128
2020-06-22 17:59:44.369547 I  OpenGL: Shaders              : Yes
2020-06-22 17:59:44.369576 I  OpenGL: NPOT textures        : Yes
2020-06-22 17:59:44.369605 I  OpenGL: Multitexturing       : Yes
2020-06-22 17:59:44.369634 I  OpenGL: Rectangular textures : No
2020-06-22 17:59:44.369663 I  OpenGL: Buffer mapping       : Yes
2020-06-22 17:59:44.369693 I  OpenGL: Framebuffer objects  : Yes
2020-06-22 17:59:44.369724 I  OpenGL: 16bit framebuffers   : No
2020-06-22 17:59:44.369754 I  OpenGL: Unpack Subimage      : Yes
2020-06-22 17:59:44.369784 I  OpenGL: GL_RED/GL_R8         : Yes
2020-06-22 17:59:44.476480 I  OpenGL: Initialised MythRenderOpenGL
2020-06-22 17:59:44.476510 I  OpenGL: Using full range output
2020-06-22 17:59:44.486492 I  MythUIHelper: Pruning cache directory: /home/pi/.mythtv/cache/remotecache
2020-06-22 17:59:44.488075 I  MythUIHelper: Kept 0 files, deleted 0 files, stat error on 0 files
2020-06-22 17:59:44.488176 I  MythUIHelper: Pruning cache directory: /home/pi/.mythtv/cache/thumbnails
2020-06-22 17:59:44.489566 I  MythUIHelper: Kept 0 files, deleted 0 files, stat error on 0 files
2020-06-22 17:59:45.615246 I  CECAdapter: Found 1 CEC devices(s).
2020-06-22 17:59:45.615382 I  CECAdapter: Device 1: path 'Raspberry Pi' com port 'RPI' SELECTED
2020-06-22 17:59:45.615422 I  CECAdapter: Trying to open device Raspberry Pi (RPI).
2020-06-22 17:59:45.616144 I  CECAdapter: connection opened
2020-06-22 17:59:45.881125 I  CECAdapter: registering new CEC client - v4.0.4
2020-06-22 17:59:46.572732 I  CECAdapter: >> source activated: Playback 1 (4)
2020-06-22 17:59:46.572838 I  CECAdapter: Source 4 Activated
2020-06-22 17:59:46.573076 I  CECAdapter: CEC client registered: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 1, logical address(es) = Playback 1 (4) , physical address: 1.0.0.0, compiled on Linux-4.15.0-48-generic ... , features: P8_USB, DRM, P8_detect, randr, RPi, Exynos, AOCEC
2020-06-22 17:59:47.205063 I  CECAdapter: << powering on 'TV' (0)
2020-06-22 17:59:47.355943 I  CECAdapter: << Playback 1 (4) -> broadcast (F): active source (1000)
2020-06-22 17:59:47.808922 I  CECAdapter: Opened CEC device.
2020-06-22 17:59:47.809239 I  CECAdapter: << powering on 'TV' (0)
2020-06-22 17:59:47.870014 I  CECAdapter: Asked TV to turn on.
2020-06-22 17:59:47.931376 I  CECAdapter: >> source activated: Playback 1 (4)
2020-06-22 17:59:47.931488 I  CECAdapter: Source 4 Activated
2020-06-22 17:59:47.931600 I  CECAdapter: << powering on 'TV' (0)
2020-06-22 17:59:47.991908 I  CECAdapter: << Playback 1 (4) -> broadcast (F): active source (1000)
2020-06-22 17:59:48.413587 I  CECAdapter: Asked TV to switch to this input.
2020-06-22 17:59:48.433638 I  Current MythTV Schema Version (DBSchemaVer): 1361
2020-06-22 18:01:55.490674 I  CardUtil[22]: Set delivery system: DVB-T2
2020-06-22 18:01:55.499970 E  CardUtil: Can't open DVB frontend (/dev/dvb/adapter0/frontend0) for /dev/dvb/adapter0/frontend0.
			eno: Device or resource busy (16)
2020-06-22 18:03:07.316046 I  CardUtil[22]: Set delivery system: DVB-T2
2020-06-22 18:03:07.322236 I  CardUtil[22]: Set delivery system: DVB-T2
2020-06-22 18:03:37.708992 I  CardUtil[22]: Set delivery system: DVB-T2

Scan parameters:
Desired Services            : tv
Unencrypted Only            : yes
Logical Channel Numbers only: no
Complete scan data required : yes
Full search for old channels: yes
Remove duplicate channels   : yes
2020-06-22 18:05:08.958596 C  'SignalMonitor': MThread prolog was never run!

Channel list (10):
auto:474000000:Liverpool TV:7:12330:9018:32840:32776=32776:dvb
auto:474000000:Tiny Pop:207:12330:9018:33472:32776=32776:dvb
#13639 fixed AV Subtitles disappear too quickly mspieth mspieth
Description

When viewing AV subtitles and there are force subtitles too, the forced subtitles remove any existing subtitles far too quickly.

This is apparent esp. in mkv files.

#13637 Duplicate SQL error in database upgrade kensheldon
Description

Query was: ALTER TABLE archiveitems DEFAULT CHARACTER SET default, MODIFY title varchar(128) CHARACTER SET utf8 default NULL, MODIFY subtitle varchar(128) CHARACTER SET utf8 default NULL, MODIFY description text CHARACTER SET utf8, MODIFY startdate varchar(30) CHARACTER SET utf8 default NULL, MODIFY starttime varchar(30) CHARACTER SET utf8 default NULL, MODIFY filename text CHARACTER SET utf8 NOT NULL, MODIFY cutlist text CHARACTER SET utf8;

Error was: Driver error was [2/1064]: QMYSQL: Unable to execute query Database error was: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default, MODIFY title varchar(128) CHARACTER SET utf8 default NUL L, MODIFY sub' at line 1

Version info follows:

2020-06-20 11:22:51.119665 C mythfrontend version: fixes/31 [v31.0+fixes.202006181245.9442315~ubuntu20.04.1] www.mythtv.org

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

ken@myhhtv:~$ apt list | grep myth | grep installed

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libmyth-python/focal,focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 all [installed,automatic]
libmyth/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
libmythes-1.2-0/focal,now 2:1.2.4-3build1 amd64 [installed,automatic]
libmythtv-perl/focal,focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 all [installed,automatic]
mytharchive/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythbrowser/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythes-en-us/focal,focal,now 1:6.4.3-1 all [installed]
mythexport/focal,now 2.2.4-0ubuntu6 amd64 [installed]
mythgame/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythimport/focal,now 2.2.4-0ubuntu6 amd64 [installed]
mythmusic/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythnews/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythplugins/focal,focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 all [installed]
mythtv-backend/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythtv-common/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythtv-database/focal,focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 all [installed,automatic]
mythtv-dbg/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythtv-frontend/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythtv-transcode-utils/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythtv/focal,focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 all [installed]
mythweather/focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 amd64 [installed,automatic]
mythweb/focal,focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 all [installed]
php-mythtv/focal,focal,now 2:31.0+fixes.202006181245.9442315~ubuntu20.04.1 all [installed,automatic]
1 2 3 4 5 6 7 8 9 10 11

Query Language

query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Filters are separated by ampersands (&). Each filter 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. To include a literal & or | in a value, escape the character with a backslash (\).

The available operators are:

= the field content exactly matches 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

Filters combining matches and negated matches can be constructed for text fields such as Keywords and CC when using the contains (~=) operator. The - operator is used to negate a match and double quotes (since 1.2.1) are used for whitespace-separated words in a phrase. For example, keywords~=word1 word2 -word3 "word4 word5" matches tickets containing word1 and word2, not word3 and also word4 word5.

status=closed,keywords~=firefox query closed tickets that contain keyword firefox
status=closed,keywords~=opera query closed tickets that contain keyword opera
status=closed,keywords~=firefox opera query closed tickets that contain keywords firefox and opera
status=closed,keywords~=firefox|opera query closed tickets that contain keywords firefox or opera
status=closed,keywords~=firefox,or,keywords~=opera query closed tickets that contain keyword firefox, or (closed or unclosed) tickets that contain keyword opera
status=closed,keywords~=firefox -opera query closed tickets that contain keyword firefox, but not opera
status=closed,keywords~=opera -firefox query closed tickets that contain keyword opera, but no firefox

The date fields created and modified can be constrained by using the = operator and specifying a value containing two dates separated by two dots (..). Either end of the date range can be left empty, meaning that the corresponding end of the range is open. The date parser understands a few natural date specifications like "3 weeks ago", "last month" and "now", as well as Bugzilla-style date specifications like "1d", "2w", "3m" or "4y" for 1 day, 2 weeks, 3 months and 4 years, respectively. Spaces in date specifications can be omitted to avoid having to quote the query string.

created=2007-01-01..2008-01-01 query tickets created in 2007
created=lastmonth..thismonth query tickets created during the previous month
modified=1weekago.. query tickets that have been modified in the last week
modified=..30daysago query tickets that have been inactive for the last 30 days

Note that modified is the last modified time, so modified with a date range shows ticket that were last modified in that date range. If a ticket was modified in the date range, but modified again after the end date, it will not be included in the results.


See also: TracTickets, TracReports, TracGuide, TicketQuery

Last modified 2 years ago Last modified on Apr 24, 2018, 9:56:48 AM