Edgewall Software

Ticket #7558 (new enhancement)

Opened 3 months ago

Last modified 6 weeks ago

New TracQuery match operator for "contains the word" would be useful

Reported by: meitarm@… Owned by:
Priority: normal Milestone: 2.0
Component: ticket system Version: 0.11.1
Severity: major Keywords: query
Cc:

Description

In a number of situations, it's useful to be able to search field values that contain a certain word, not just a certain string (as ~= does). The distinction is essentially a word boundary regex versus an all-inclusive regex. That is, I'd like to be able search like this:

.*\bmyvalue\b.*

where \b is a "word boundary" as defined by the PCRE standards. Right now, using ~=, I can only search like this:

.*myvalue.*

The most pressing use case for such a facility (at least for my projects) is support for "subticket keywords", an extremely flexible technique of associating one ticket with another by using the TracLinks conventions in the keyword field.

For example, to associate a new ticket as a "subticket" of ticket:13, I place #13 in its keyword field. Currently, this can later be extracted with a TracQuery such as [[TracQuery(keywords~=#13)]] however this incorrectly matches #130, #131, and so on. Thus, a word boundary match operator was suggested by Remy Blank later in the same thread.

At first blush, it seems that the TracQuery "mini language" is actually implemented with simple ANSI SQL-based wildcards, which makes implementing word boundary matches non-trivial. I'd imagine one might have to wrap a call to Query.execute that catches the results of a ~= query and then filters these results further (possibly with a decorator?).

Attachments

Change History

Changed 3 months ago by osimons

#7374 closed as duplicate.

Changed 6 weeks ago by rblank

  • milestone set to 2.0

Add/Change #7558 (New TracQuery match operator for "contains the word" would be useful)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from (none). Next status will be 'new'
The owner will change from (none) to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.