wiki:TracQuery

Version 2 (modified by trac, 7 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:

#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.

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

[[TicketQuery(version=1.0|2.0&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

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