Project

General

Profile

Actions

Defect #38055

closed

Filter operator "doesn't contain" on custom fields ignores issues with no value

Defect #38055: Filter operator "doesn't contain" on custom fields ignores issues with no value

Added by Ko Nagase almost 4 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Filters
Target version:
Resolution:
Fixed
Affected version:

Description

How to reproduce

  1. Prepare a working environment
    $ RAILS_ENV=development bin/rails db:fixtures:load
    
  2. Start Redmine and display http://localhost:3000/issues without login.
  3. 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.
  4. Select "Searchable field" from "Add filter", select operator "contains" and value 125.
    =>The result is 2 issues.
  5. 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)

Expected behavior

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.

Possible Causes

The filter ignore issues which the custom field "Searchable filter" is not present when the filter is "doesn't contain".

Solution patch

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.
Thanks,


Files

2022-12-17-issue-filter.patch (1.69 KB) 2022-12-17-issue-filter.patch Ko Nagase, 2022-12-17 08:53
38055-v2.patch (1.33 KB) 38055-v2.patch Go MAEDA, 2026-02-17 03:37

Updated by Ko Nagase almost 4 years ago Actions #1

Sorry, I missed to attache the patch, so I upload it in this post.

Updated by Go MAEDA almost 4 years ago Actions #2

  • Status changed from New to Confirmed

Updated by Go MAEDA almost 4 years ago Actions #3

  • Target version set to Candidate for next major release

Updated by Go MAEDA 10 months ago Actions #4

  • File 38055-v2.patch 38055-v2.patch added
  • Subject changed from Inconsistent results for filtering issues containing custom fields to Filter operator "doesn't contain" on custom fields ignores issues with no value
  • Target version changed from Candidate for next major release to 7.0.0

Updated the patch for the current trunk (r24419).

Setting the target version to 7.0.0.

Updated by Go MAEDA 10 months ago Actions #5

  • Status changed from Confirmed to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r24432. Thank you for your contribution.

Actions

Also available in: PDF Atom