Inconsistent results for filtering issues containing custom fields
|Target version:||Candidate for next major release|
How to reproduce¶
- Prepare a working environment
$ RAILS_ENV=development bin/rails db:fixtures:load
- Start Redmine and display http://localhost:3000/issues without login.
- From filters, check off "Status" then add "Tracker" filter with operator "is" and value "Bug" and "Support request" (Because "Searchable field" custom field is only available in those trackers).
=>The result is 8 issues.
- Select "Searchable field" from "Add filter", select operator "contains" and value 125.
=>The result is 2 issues.
- Change the operator to "doesn't contain" and apply it.
=>The result is 1 issues.
The total number of cases in No.4 and No.5 is 3 which does not match the total number of issues (6)
The sum of the results of "contains" and "doesn't contain" matches the total number of issues.
If the condition is "is" and "is not", the sum of the results matches the total number of issues.
The filter ignore issues which the custom field "Searchable filter" is not present when the filter is "doesn't contain".
To make the behavior consistent with "is" and "is not", the "doesn't contain" result should include the number of issues that do not have the custom field.
We (@tomokosimi, @tohosaku, @ishikawa999 and @sanak) created the attachment patch file which solves this issue by modifying "not contains" operator SQL only when searching custom field values, so reviewing this is helpful.