Description:

Searches issues having comments, additionally you can further refine your query by using a number expression.

Note:

A 'number expression' is made of an optional operator representing by its mathematical symbol and a (prositive/negative) number.

 Let's see the allowed symbols...
OperatorSymbol
Equals to=
Not equals to!=
Greater than>
Greater than or equals to>=
Less than<
Less than or equals to<=

(warning) By default, this function only includes issues with at least one comment even if you use the '<' or '<=' operator. You must explicity add 'issues NOT IN hasComments()' clause to your query, if you also want to search for issues without comments.


Syntax

hasComments()
hasComments(numberExpression)

Available sincev2.0.0-RELEASE
Supported fieldsIssue
Supported operatorsIN , NOT IN
Unsupported operators

= , != , ~ , !~ , > , >= , < , <=

IS , IS NOT , WAS , WAS IN , WAS NOT , WAS NOT IN , CHANGED

Examples:

• Find issues without comments:

issue NOT IN hasComments()

• Find Stories that have three or more comments

type = Story AND issue IN hasComments(">= 3")

• Find issues within the EMEA project having less than 2 comments or with no comments at all.

project = EMEA AND (issue IN hasComments("< 2") OR issue NOT IN hasComments())

Real World Use Cases:

· JRASERVER-40308 - JQL query to filter by comment quantity (by Vincent Chin)
·
Is it possible to search for issues with no comments? (by Svante Gustafsson at ATLASSIAN Community)
·
Filter issue that has comment (by Pangianto Pang at ATLASSIAN Community)
· How can I filter issues by comment count?(by Stanislav Golodov Reis at ATLASSIAN Community)

JQL Function Reference