query language syntax differences for [query:?] vs. [[TicketQuery]]

12 views
Skip to first unread message

Clemens Feige

unread,
May 24, 2022, 6:52:53 AMMay 24
to Trac Users
Hello

I have been struggling with some differences in the query language for
[query:?] vs. [[TicketQuery]]. I might have misunderstand something. Or
maybe the documentation may need an improvement.

According to the documentation both [query:?] and [[TicketQuery]] share
the same query language:

https://trac.edgewall.org/wiki/TracQuery#QueryLanguage

However, first of all a major difference is the separator character.
While [query:?] needs `&`, the [[TicketQuery]] promotes `,` but also
accepts `&`.

Second difference is the position of the `=` match operator in regards
to other operators like `!` but also `~`. While [query:?] needs `=!`,
the [[TicketQuery]] accepts both variant `!=` and `=!`.

[query:?status=new&keywords=!foo tickets]

[[TicketQuery(status=new,keywords=!foo,count)]]

I guess there are technical and historic reasons for those differences.
[query:] seems close to the URL query format, and [[TicketQuery()]] as a
powerful macro seems more generous.

I do not complain and I am more than willing to accept. But it took me 2
hours to find out. I would propose (and volunteer) to add a small note
in the documentation, which would remind these differences. Something
like this:

> ... Filters are separated by ampersands (`&`); the `[[TicketQuery]]` macro also accepts comma (`,`).

> Note that for `query:` the match operator `=` needs to be on first position when combined with other operators, for example `=!` or `~=`.

If I have totally misunderstood something, please correct me.

Thanks
Clemens


P.S.

There is a very old related ticket #7699, but it did not come to a
conclusion.

https://trac.edgewall.org/ticket/7699

RjOllos

unread,
May 27, 2022, 12:55:50 AMMay 27
to Trac Users
I have found it confusing as well. I think you should feel free to go ahead with the documentation edits.

Ryan 

Clemens Feige

unread,
May 27, 2022, 1:17:07 PMMay 27
to Trac Users
RjOllos wrote on 27.05.2022 at 06:55:

On Tuesday, May 24, 2022 at 3:52:53 AM UTC-7 Clemens wrote:
Hello

I have been struggling with some differences in the query language for
[query:?] vs. [[TicketQuery]]. I might have misunderstand something. Or
maybe the documentation may need an improvement.


I have found it confusing as well. I think you should feel free to go ahead with the documentation edits.

Ryan 


Done! I updated the "Query Language" section.

https://trac.edgewall.org/wiki/TracQuery?action=diff&version=61

Clemens

Reply all
Reply to author
Forward
0 new messages