Edgewall Software
Modify

Opened 15 years ago

Closed 11 years ago

#8329 closed defect (duplicate)

When there are multiple values for the same key in a TicketQuery only the last value is used

Reported by: Michael G Schwern <schwern@…> Owned by:
Priority: normal Milestone:
Component: ticket system Version: 0.10.4
Severity: normal Keywords: TicketQuery
Cc: dylan@…, zack@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Example…

TicketQuery(keyword=~foo&keyword=~bar)

Rather than being equivalent to "keyword contains 'foo' and keyword contains 'bar'" it is only "keyword contains 'bar'". But if you reverse them…

TicketQuery(keyword=~bar&keyword=~foo)

It is only "keyword contains 'foo'".

This suggests that the search keys are being thrown into a dictionary and only the last value is being kept.

I found this while trying to make a TicketQuery that matched tickets which contain a given key but also do not contain certain others. For example…

TicketQuery(keywords=~implemented&keywords!~=pass|fail)

The intent was to match implemented tickets which haven't been through QA. But it will match any tickets without pass or fail, but ignore the "implemented" part.

The functionality I expect is for multiple instances of the same key to be treated as "and"'s.

Attachments (1)

Pasted_Image_5_20_13_5_11_PM-3.png (73.1 KB ) - added by lloyd@… 11 years ago.
Screenshot of attempt at multiple-keyword AND query

Download all attachments as: .zip

Change History (10)

comment:1 by Remy Blank, 15 years ago

Resolution: duplicate
Status: newclosed

This is a duplicate of #8041, which was fixed in 0.11.3. Time to upgrade!

comment:2 by Michael G Schwern <schwern@…>, 15 years ago

Ahh, excellent! Thanks! Sorry for the dup.

comment:3 by Michael G Schwern <schwern@…>, 15 years ago

Resolution: duplicate
Status: closedreopened

Oh, wait, not quite a dup. I see the problem was fixed, but in a different way than I'm requesting.

#8041 makes these equivalent

query:owner=somebody|somebody_else
query:owner=somebody&owner=somebody_else

I'm looking for a way to "and" terms, not "or". AFAIK there's no way to say "contains X keyword and Y keyword but not Z keyword". Is there?

in reply to:  3 comment:4 by Christian Boos, 15 years ago

Resolution: duplicate
Status: reopenedclosed

Replying to Michael G Schwern <schwern@…>:

I'm looking for a way to "and" terms, not "or". AFAIK there's no way to say "contains X keyword and Y keyword but not Z keyword". Is there?

See #4775, feedback on the patch you'll find there will be much appreciated ;-)

comment:5 by Michael G Schwern <schwern@…>, 15 years ago

#4775 would appear to solve "contains X and Y" but not "contains X and not Y". Is that right?

comment:6 by Christian Boos, 15 years ago

Right, we could imagine using -Y for negating the keyword Y, like we do in the Timeline author box (see 0.12/TracTimeline).

comment:7 by lloyd@…, 11 years ago

I'm afraid #4475 Does not address this case (assuming this ticket is limited to AND queries across multiple keywords.

In trac 0.12.5, these two queries are not equivalent:

[[TicketQuery(keywords~=foo,and,bar)]]
[[TicketQuery(keywords~=bar,and,foo)]]

In both cases, the last-specified keyword value overwrites any previously-specified value.

This is also reflected in the custom-query interface. If you attempt to build a query by adding multiple "keywords" matches as AND values, they are rolled up together and OR'd.

by lloyd@…, 11 years ago

Screenshot of attempt at multiple-keyword AND query

comment:8 by anonymous, 11 years ago

Resolution: duplicate
Status: closedreopened

Reopening, per comment and screenshot above.

comment:9 by Jun Omae, 11 years ago

Resolution: duplicate
Status: reopenedclosed

A duplicate of #9736 for "AND" query.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


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