Trac Ticket Queries
Table of Contents
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 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 and no name/email 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 pulldown 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 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.
Navigating Tickets
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.
Using TracLinks
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:
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:
Using the [[TicketQuery]] Macro
The TicketQuery macro lets you display lists of tickets matching certain criteria anywhere you can use WikiFormatting.
Example:
[[TicketQuery(version=0.6|0.7&resolution=duplicate)]]
This is displayed as:
- #26
- A registered person creates their own tags for a package
- #75
- Record and display package "usage" information
- #87
- Multiple download links
- #97
- Do not create a distribution on a path is something already exists there
- #106
- Regularly convert CKAN data to RDF and put on Talis CC
- #125
- Edit Generic Package Attributes in WUI
- #137
- User has editable home page
- #144
- Most popular packages listed on homepage
- #147
- Parser and loader for esw.org data
- #151
- User object should have a created attribute
- #153
- Group's packages listed alphabetically
- #155
- Adding multiple packages to a group
- #168
- Show admins for a group in group view
- #169
- Package derivations
- #176
- Package dependencies
- #180
- Tag cloud as way to view CKAN tags
- #186
- Automated upload to archive.org s3
- #188
- Improve package listing views
- #228
- Deal with duplicate packages
- #245
- Support for composite primary keys
- #246
- Support for primary key not named id
- #268
- Select groups in Package edit form
- #294
- Add/remove extra fields in Package edit form
- #296
- Commit CKAN revisions to changeset system
- #297
- Update CKAN repository from changeset system
- #298
- Pull changesets from remote CKAN instance
- #299
- Merge diverging lines of changesets
- #306
- datapkg build command
- #308
- Autocomplete package names & tags in package search
- #321
- Delegate authentication to Drupal
- #358
- Resources in REST API
- #394
- Fix munin on DGU (?)
- #395
- Set up profiling to analyze performance issues
- #402
- Archiving worker to back up package resources from a CKAN instance
- #440
- Write and pass comprehensive performance tests
- #441
- CKAN read-only state
- #444
- Discuss package relationships ideas with JF
- #456
- Daily dump
- #464
- Request dgu db server access
- #467
- Admin configures CKAN to expect API key in named HTTP header
- #477
- Discover location of the daily database dumps
- #485
- Performance beats QoS criteria
- #486
- Catalogue service shall notify and query SOLR service
- #487
- Notify SOLR service of model events
- #497
- Respond to CSW "GetRecords" request
- #500
- Exception from diff
- #501
- Read-only maintenance mode
- #512
- User creates package via API with incorrect core fields specified
- #514
- Inconsistent use of 'location' header in API
- #535
- genshi error when logged into sl.ckan.net
- #537
- Caching and Performance improvement
- #543
- Investigate partial page caching and edge-side includes
- #544
- Backport facet browsing to CKAN 1.2
- #561
- Deleted packages are returned in the API
- #563
- Support a minimal CSW server interface or export to GeoNetwork
- #570
- Validate metadata document against UKLP schematron
- #573
- Add metadata entity to harvesting queue
- #574
- Create UKLII package with attributes from remote metadata record
- #580
- Write (create or update) CKAN package for metadata document
- #612
- Check given XML schema validates given metadata document
- #617
- Check UKLP schematron validates given metadata document
- #665
- The system shall support withdrawing a harvested dataset or service from publication
- #691
- Package Relationships
- #702
- The system shall support changing package groups when editing a package
- #730
- Back up package data from all CKAN packages to storage.ckan.net
- #740
- Get copy of harvested metadata for a given package
- #748
- Link new sample package to previous sample package of continuous series
- #749
- Fold up continuous series in search results behind newest sample package
- #750
- Get CSW records modified since given time
- #751
- Get harvested document for a given package
- #752
- Change package attribute names used by Gemini harvesting to DGU "v.4"
- #755
- Add filter attribute to harvest source entity
- #756
- Add filter field to harvest source form
- #757
- Create migration script to add harvest source filter attribute to existing tables
- #758
- Change API documentation to indicate harvest source entity has filter attribute
- #759
- Construct and send filtered CSW GetRecords request
- #760
- Change "CSW Get Records" request class to accept and used given CSW filter
- #764
- Read-only CKAN Web UI
- #766
- The system shall support harvesting metadata from ArcGIS
- #768
- Obtain example ArcGIS CSW server
- #769
- Tests for harvesting metadata from ArcGIS CSW API
- #772
- Run CLI harvester command without arguments
- #773
- Fix CLI help command to return CLI help message
- #774
- Fix CLI harvester command to return harvester help message
- #776
- Avoid generating vdm warnings
- #781
- Package edit form - 'extra' fields have 'add' and 'delete' buttons
- #783
- Delete harvested documents when remote metadata disappears from harvest source
- #786
- The system shall support deleting a registered harvest source
- #788
- API user deletes harvest source
- #789
- The harvest source form shall validate location field by positive identification of source type
- #790
- Submit harvest source form with valid CSW location
- #791
- Submit harvest source form with invalid CSW location
- #795
- "Match up" GEMINI2 "metadata point of contact" with registered entities
- #799
- WAF harvesting shall be optimised in respect of reharvesting only records that have changed
- #800
- Get WAF records modified since given time
- #801
- Get/Set last harvested time for a given harvest source
- #802
- Save last harvested time on source
- #815
- Autocomplete for the search field
- #841
- Caching docs (as a whole)
- #849
- Import extra CSS from main template
- #886
- move uklii forms api to dgu module
- #896
- Distributed Data and Syncing Between CKAN Instances
- #897
- "New package" highlighted in Navigator when searching
- #916
- Port new vdm to Mongodb
- #922
- Make Resources first class entity.
- #947
- Move the assignment of roles to a package on package creation to an extension
- #958
- ui for new kind field
- #971
- Support middleware as a plugin
- #985
- Harvest other data catalogues
- #987
- Common harvesting framework
- #997
- change create on cli to upgrade
- #1005
- Editing in ckan missing publishers
- #1024
- Lock down all controller actions in CKAN
- #1034
- Flash message cached
- #1064
- Remove Workers from ckanext-queue
- #1094
- [super] Refactor the Auth System
- #1102
- searching broken in development setup
- #1103
- searching broken in development setup
- #1161
- Build a simplified theme for PDEU
- #1200
- Port PDEU theme to CKAN.net
- #1279
- Refactor or deprecate Authorization Groups
- #1309
- Registering new user requires immediate login
- #1313
- Tweaks to captcha configuration
- #1327
- [super] Dataset Archiving
- #1410
- Add Gravatars to user profiles
- #1418
- If default language is not 'en' then you can't switch language to 'en'
- #1514
- Modifying user name loses connection with revisions
- #1568
- Moderated Edits
- #1586
- 'Sort by' field for package search
- #1603
- Search query builder
- #1610
- Move webstore to Postgres instead of Sqlite
- #1611
- Implement auth API calls for webstore/external use
- #1634
- Allow users to follow/unfollow activity streams of other users, datasets and groups
- #1656
- Configuration for reverse proxying
- #1677
- Make synchronous search the default behaviour
- #1682
- [super] Translatability for EC
- #1702
- Normalize character encoding for ckan search.
- #1706
- Tag taxonomies package schema
- #1707
- Over-long URLs in QA ext broken links list
- #1729
- Helper function for extensions to add vocabularies to a ckan instance
- #1780
- Api to add translations.
- #1793
- Publisher changes
- #2201
- Add citation info to Dataset and Resource page
- #2222
- Tests are broken for some of us: NotAPairTreeStoreException
- #2238
- Deploy some test vocabs and publishers on test.ckan.net, check tutorial-style instructions for these
- #2273
- Review publisher organisations code with Ross
- #2312
- Analysis of how datasets could belong to users instead of Groups
- #2344
- Get jenkins install script into CKAN core
- #2380
- DataGM Upgrade
- #2398
- Ubuntu 10.04 source install instructions not working?
- #2423
- Get rid of CKAN's lxml dependency
- #2424
- Get rid of CKAN's autoneg dependency
- #2462
- Add converter to rename resource_type field to type
- #2469
- Find a better way to deploy CKAN instances
- #2495
- Stats page has lost styling ...
- #2534
- ckanext-spatial is broken with CKAN 1.8b
- #2544
- facet.sort is not available in the package_search action
- #2610
- Text / link changes
- #2628
- Add docs for upgrading a source install
- #2629
- Move ckanext-examplevocabs into master and document
- #2630
- UPdate docs after IDatasetForm schema change
- #2636
- Style activity stream in user profile
- #2681
- autofill on resource format
- #2764
- Simplify filestore
- #2832
- can't add a dataset to more than one group
- #2946
- Pdf preview does not load in IE
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. This also allows displaying the link and description of a single ticket:
[[TicketQuery(id=123)]]
This is displayed as:
- #123
- Ability to edit Group in WUI
A more compact representation without the ticket summaries is also available:
[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]
This is displayed as:
#26, #75, #87, #97, #106, #125, #137, #144, #147, #151, #153, #155, #168, #169, #176, #180, #186, #188, #228, #245, #246, #268, #294, #296, #297, #298, #299, #306, #308, #321, #358, #394, #395, #402, #440, #441, #444, #456, #464, #467, #477, #485, #486, #487, #497, #500, #501, #512, #514, #535, #537, #543, #544, #561, #563, #570, #573, #574, #580, #612, #617, #665, #691, #702, #730, #740, #748, #749, #750, #751, #752, #755, #756, #757, #758, #759, #760, #764, #766, #768, #769, #772, #773, #774, #776, #781, #783, #786, #788, #789, #790, #791, #795, #799, #800, #801, #802, #815, #841, #849, #886, #896, #897, #916, #922, #947, #958, #971, #985, #987, #997, #1005, #1024, #1034, #1064, #1094, #1102, #1103, #1161, #1200, #1279, #1309, #1313, #1327, #1410, #1418, #1514, #1568, #1586, #1603, #1610, #1611, #1634, #1656, #1677, #1682, #1702, #1706, #1707, #1729, #1780, #1793, #2201, #2222, #2238, #2273, #2312, #2344, #2380, #2398, #2423, #2424, #2462, #2469, #2495, #2534, #2544, #2610, #2628, #2629, #2630, #2636, #2681, #2764, #2832, #2946
Finally, if you wish to receive only the number of defects that match the query, use the count parameter.
[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]
This is displayed as:
166
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 by placing pipes (|) between the columns like below:
[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]
This is displayed as:
Results (1 - 3 of 2152)
Ticket | Resolution | Summary | Owner | Reporter |
---|---|---|---|---|
#3024 | fixed | Add activity stream tab to dataset read page | seanh | |
#3022 | fixed | setup_template_variables method of IDatasetForm never called | amercader | amercader |
#3015 | invalid | Dropdowns don't work without JavaScript | johnmartin | johnmartin |
Full rows
In table format you can also have full rows by using rows=<field> like below:
[[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 2152)
Ticket | Resolution | Summary | Owner | Reporter |
---|---|---|---|---|
#3024 | fixed | Add activity stream tab to dataset read page | seanh | |
#3022 | fixed | setup_template_variables method of IDatasetForm never called | amercader | amercader |
Description |
On the package controller the package_type is not passed to the lookup function, so the setup_template_variables defined on the extensions is never called |
|||
#3015 | invalid | Dropdowns don't work without JavaScript | johnmartin | johnmartin |
Description |
Essentially the default bootstrap dropdowns don't work properly without JavaScript? which is a little bit of an issue with JS not working. |
Query Language
query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Basically, the filters are separated 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. 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 |
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 left out 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 |
See also: TracTickets, TracReports, TracGuide