Edgewall Software
Modify

Opened 16 years ago

Last modified 7 years ago

#7558 new enhancement

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

Reported by: meitarm@… Owned by:
Priority: low Milestone: next-major-releases
Component: ticket system Version: 0.11.1
Severity: minor Keywords: query keywords exact match
Cc: mmitar@…, m.galante@… Branch:
Release Notes:
API Changes:
Internal Changes:

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 (0)

Change History (8)

comment:1 by osimons, 16 years ago

#7374 closed as duplicate.

comment:2 by Remy Blank, 16 years ago

Milestone: 2.0

comment:3 by Christian Boos, 15 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:4 by Carsten Klein <carsten.klein@…>, 15 years ago

see also #8914 for a patch that would allow regular expression matching for all of the available backends.

comment:5 by Christian Boos, 14 years ago

Keywords: keywords exact match added
Milestone: triagingnext-major-0.1X
Priority: normallow
Severity: majorminor

#9466 was closed as duplicate.

Note that for the specific use case of "subtickets" described above, this could be handled easily by adopting a slightly different convention: instead of referencing #13, you could add #13. for example, and there would be no false positive ("real" SubTickets support will eventually involve a numbering scheme corresponding to #13.1, #13.2, #13.2.1 etc.).

comment:6 by Mitar, 14 years ago

Cc: mmitar@… added

comment:7 by m.galante@…, 12 years ago

Cc: m.galante@… added

comment:8 by ryandesign, 7 years ago

So, what's up? This ticket and the related and duplicate tickets date back over 11 years. When can we have a method in Trac for searching for complete words in the keywords field? I don't care what the method is as long as I can express it as a search query that I can include in a ticket.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.