-
Suggestion
-
Resolution: Won't Do
-
None
-
57
-
24
-
-
NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.
Expected Behavior
The NOT / != operator in a JQL query should return issues with no value set for the searched field or with an empty value.
Actual Behavior
Issues with non-existing or empty values for the searched field are excluded from the search.
Example #1
- I have the below query on a filter, which returns all issues not assigned to the user admin;
assignee != admin
- This filter returns issues assigned to all users but admin, however it doesn't return unassigned
Example #2
- A JIRA instance has 100 issues;
- 90 issues are under a issue type which should have a field named "Color";
- 80 of those issues have a value for the "Color" field;
- 30 of those 80 issues have the color set to "Red";
- The below query returns 50 issues, whereas it should return 70 issues based on the logical value of !=, which is "not equals to", what should imply "empty" or "null";
Color != "Red"
Example #3
- Below query, should returns all issues with fixVersion not equals to 2.
fixVersion not in (2)
- but it doesn't return issues with EMPTY values in fixVersion
- Proper JQL query is, which is not intuitive:
fixVersion not in (2) or fixVersion is EMPTY
- Taking into account that IN is alias to (= OR , ...)
Steps to Reproduce
- Run a filter similar to the below;
assignee != admin
- Un-assign one of the issues returned by the filter;
- Re-run the search;
Notice the unassigned issue will be now be missing.
Workaround
Create a filter for issues which have a positive match for the value you are trying to exclude.
Example
- Create a new filter with the below query and give it a name (e.g. Admin's Issues)
assignee = admin
- Run a search with the below query;
filter != "Admin's Issues"
Testing Notes
Using Luke to query the Lucene index directly and searching for -color:red you get 70 issues on the use-case presented above (in "Example #1", under "Actual Behavior").
- derived from
-
JRASERVER-39830 Filter on resolution not working as expected
-
- Closed
-
- is duplicated by
-
JRASERVER-29179 When searching for Issues, negative filtering does not return empty values
-
- Closed
-
-
JRASERVER-41114 JQL search ignores issues that have empty fields
-
- Closed
-
-
JRASERVER-42424 JQL: NOT IN or != Operators Removes Empty Values
-
- Closed
-
-
JRASERVER-42750 Adding "AND fixversion not in ("USX Backlog")" excludes EMPTY versions also
-
- Closed
-
-
JRASERVER-28777 Filter with !~ or "not in" does not consider empty fields or Resolution "Unresolved"
- Closed
-
JRASERVER-33000 Improve JQL or Issue Navigator to handle Logic
- Closed
-
JRASERVER-47747 When using category not in it excludes projects with no category value.
- Closed
- is related to
-
JRASERVER-61841 JQL behavior for "not in" doesn't include empty list
- Closed
-
GHS-137862 Loading...
- relates to
-
JRASERVER-22130 JQL: Invalid or incomplete result sets when querying for "watcher" vs. "not watcher"
-
- Closed
-
-
JRASERVER-39830 Filter on resolution not working as expected
-
- Closed
-
-
JRACLOUD-23030 Not equals operator (!=) excludes results with empty values in JQL
- Gathering Interest
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
The issue: `a=b or a!=b` evaluates to `false`
Jira response: yeah, we've already told you that when we say equal we mean something else
Let's see what was it that you meant, shall we:
The "!=" operator will not match a field that has no value (i.e. a field that is empty). For example, component != fred will only match issues that have a component and the component is not "fred"
So it "will not match" then. Cool, then we should at least be able to use this very easy workaround `NOT component = fred` after all it's simply "not matching", i should be able to just filter the results where it doesn't match `component = fred`, right?
Wrong. It is evidently and clearly different from "not matching". The expression `component = fred` does not yield `false`, it only evaluates to that later. It's something that both itself and its negated counterpart is `false`. The component is and is not fred at the same time according to this design.
I think Jira is under the impression that this is a debate and having added this as a "design choice" in the docs is winning the argument. I think Jira needs to know that we are not at all interested in a "i said it first" type of justification. If there is a technical necessity like something breaking otherwise, we're all ears. Other than that, we don't care if it's bad coding or bad design.
This is something you are selling to people. You can make a design choice for a car having the pedals on the passenger seat and include it in the documents, but you can't sell it. No matter how confident you seem telling people to "just get the passenger to use the pedals" as a workaround
Anyway, I better read the entirety of Jira documentation for any hidden custom definitions for operators. Who knows maybe the `+` operator has an exception too, like if both numbers are prime it multiplies instead of adding. It would technically be a design choice after all. Unless of curse you have another meaning for design choice in the docs