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: | 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)
Change History (10)
comment:1 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
follow-up: 4 comment:3 by , 15 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
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?
comment:4 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
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 , 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 , 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 , 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 , 11 years ago
Attachment: | Pasted_Image_5_20_13_5_11_PM-3.png added |
---|
Screenshot of attempt at multiple-keyword AND query
comment:8 by , 11 years ago
Resolution: | duplicate |
---|---|
Status: | closed → reopened |
Reopening, per comment and screenshot above.
comment:9 by , 11 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
A duplicate of #9736 for "AND" query.
This is a duplicate of #8041, which was fixed in 0.11.3. Time to upgrade!