Complex and/or conditions in queries

14 views
Skip to first unread message

Mo

unread,
Dec 2, 2019, 10:13:43 AM12/2/19
to Trac Users
Hi,

as far as I understand it is only possible to have AND operators by default and OR operators between AND-Groups.
So it is not possible to have
(Owner is "foo" OR Owner is "bar") AND Created between 2018-01-01 and 2019.01.01

Is it possible to create some query like this with the query syntax and not using SQL?

So it is not possible to group and nest any AND/OR groups with ().

This old ticket already requested an AND operator:
https://trac.edgewall.org/ticket/9736

Best regards,
- Mo

Jun Omae

unread,
Dec 2, 2019, 10:27:31 AM12/2/19
to trac-...@googlegroups.com
On Tue, Dec 3, 2019 at 0:13 Mo <burcheri...@gmail.com> wrote:
Hi,

as far as I understand it is only possible to have AND operators by default and OR operators between AND-Groups.
So it is not possible to have
(Owner is "foo" OR Owner is "bar") AND Created between 2018-01-01 and 2019.01.01

At least, it is able to query via TracLink or query page like this:

--
Jun Omae <jun...@gmail.com> (大前 潤)

Mo

unread,
Dec 2, 2019, 10:59:16 AM12/2/19
to Trac Users
Am Montag, 2. Dezember 2019 16:27:31 UTC+1 schrieb Jun Omae:

At least, it is able to query via TracLink or query page like this:


Ok, bad example. Our real queries are more complex like the following. The red part is not possible yet:

(
  ( Developer contains "$USER" and Development is not "done" and Status is not "closed" )
  OR
  ( Tester contains "$USER" and Test is not "done" and Status is not "closed" )
  OR
  ( Reviewer contains "$USER" and Review is not "done" and Status is not "closed" )
  OR
  ( Author contains "$USER" and Documentation is not "done" and Status is not "closed" )
)
AND
(
  duedate between 2019-11-01 and 2019-12-01
)


Can I achieve that at least with the macro or by URL?

Jun Omae

unread,
Dec 2, 2019, 10:10:32 PM12/2/19
to trac-...@googlegroups.com
You could use `query:...or...or...`.

query:developer=~$USER&development=!done&status=!closed&duedate=2019-11-01..2019-12-01&or&tester=~$USER&test=!done&status=!closed&duedate=2019-11-01..2019-12-01&or&reviewer=~$USER&review=!done&status=!closed&duedate=2019-11-01..2019-12-01&or&author=~$USER&documentation=!done&status=!closed&duedate=2019-11-01..2019-12-01

Mo

unread,
Dec 3, 2019, 5:24:42 AM12/3/19
to Trac Users
Am Dienstag, 3. Dezember 2019 04:10:32 UTC+1 schrieb Jun Omae:
You could use `query:...or...or...`.

query:developer=~$USER&development=!done&status=!closed&duedate=2019-11-01..2019-12-01&or&tester=~$USER&test=!done&status=!closed&duedate=2019-11-01..2019-12-01&or&reviewer=~$USER&review=!done&status=!closed&duedate=2019-11-01..2019-12-01&or&author=~$USER&documentation=!done&status=!closed&duedate=2019-11-01..2019-12-01

Ok, I know I could transform any and into or, such as repeating the duedate in every or-block. That will enlarge the queries a lot. So for now there is no way to group expressions in ( ) parenthesis and to have nested and/or operators.
Reply all
Reply to author
Forward
0 new messages