#9731 closed defect (invalid)
Custom queries broken when using "contains" with a multi-select custom field
Reported by: | Jan Beilicke | Owned by: | CM Lubinski |
---|---|---|---|
Priority: | normal | Component: | MultiSelectCustomFieldsPatch |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
Attached please find a modified version of the original patch that fixes the mentioned issue in Trac 0.12. The bug in ticket/query.py
line 545 lead to wrong database results, due to a pipe right before the last percentage:
Original patch:
value = '%' + value + '|%'
Modified version:
value = '%' + value + '%'
Attachments (1)
Change History (5)
Changed 13 years ago by
Attachment: | multi-fields.diff added |
---|
comment:1 follow-up: 2 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 follow-up: 3 Changed 13 years ago by
Replying to cmc:
That is not correct. All multi-select values should end with a pipe. Hence, '%' + value + '%' may actually return incorrect result.
You are right, of course. Quite obvious, but I didn't see this. Thanks for the clarification. I will revert my patch and check again why the queries with multi-selects are not working as expected. :)
comment:3 follow-up: 4 Changed 13 years ago by
Replying to jbeilicke:
Replying to cmc:
That is not correct. All multi-select values should end with a pipe. Hence, '%' + value + '%' may actually return incorrect result.
You are right, of course. Quite obvious, but I didn't see this. Thanks for the clarification. I will revert my patch and check again why the queries with multi-selects are not working as expected. :)
Mind you, this patch was originally written for 0.11 and I haven't worked on the 0.12 version for a year. I wouldn't be at all surprised if there was a bug somewhere else ;) Are the fields savings with pipes? If you're converting an existing field over to use multi-select, you'll need to append a pipe to each value.
comment:4 Changed 13 years ago by
Replying to cmc:
Replying to jbeilicke:
Replying to cmc:
That is not correct. All multi-select values should end with a pipe. Hence, '%' + value + '%' may actually return incorrect result.
You are right, of course. Quite obvious, but I didn't see this. Thanks for the clarification. I will revert my patch and check again why the queries with multi-selects are not working as expected. :)
Mind you, this patch was originally written for 0.11 and I haven't worked on the 0.12 version for a year. I wouldn't be at all surprised if there was a bug somewhere else ;) Are the fields savings with pipes? If you're converting an existing field over to use multi-select, you'll need to append a pipe to each value.
That is the case: I have to append the pipe. Thanks again.
That is not correct. All multi-select values should end with a pipe. Hence, '%' + value + '%' may actually return incorrect result.
Imagine if options were 'Dog' and 'Dog Park'. If you searched for 'Dog', a ticket with 'Dog Park' (in the database, 'Dog Park|') would come up with your proposed change. Instead, if you search for '%Dog|%', no Dog Park entries will be returned.