CQL to filter comments and labels

Aaron Pavez September 6, 2022

Hi Everyone!

I've been trying to get a CQL working. The use case is:

1. report that returns a list of comments made to pages within a single space

2. over the past 7 days

3. filter by a specific label ( i can't make this one work)

This is the query I have (minus the label):

space="LANDING" and type=comment and created >= now("-7d")

 This filters out the comments in the last 7 days. But if I add the label:

space="LANDING" and type=comment and created >= now("-7d") and label in (remove)

Then the query returns 0.

I tried adding the type=page (and / or). With AND  it shows 0 results. If I use the OR then the returns are all comments (it bypasses the created >=now)

space="LANDING" and type=comment or type=page and created >= now("-7d") and label in (remove) order by lastModified desc

Is this a CQL limitation? I can't find information about that.

Thanks for the help!

Regards

1 answer

1 accepted

1 vote
Answer accepted
Rodrigo
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 14, 2022

Hello @Aaron Pavez 

Unfortunately, this combination is not possible, as the Comments do not "inherit", or "receive" the label attribute, only the page. Thus, they are not shown in the results, because the comments themselves do not carry the Label, but the Page is the one that does.

Ill attach a link to a ticket where Atlassian mentions this.

  • "...there is pretty much no point in using the attachments, mail and comments values with this parameter. Because there is no way to label these content types in Confluence, the 'content by label' macro will always return no results if you force this macro to filter for labels associated with these content types. Therefore, I have removed these value suggestions from the documentation…"

CONFSERVER-16073 

Hopefully this will be useful to anyone who seeks to achieve the same as we did.

With friendly regards
Rodrigo

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events