Content by Label Macro Error - 'With Ancestor' not working
Asked by Evan Powell:

Hello,

I am trying to tabulate documents with a specific label from other pages in different page trees within the same space using the content by label macro. When I only use the label and space filters in the macro, it seems to work perfectly fine. In other words, it is searching the whole space. However, I only want to look at documents with a specific ancestor so I use the 'with ancestor cql filter as described here (<https://confluence.atlassian.com/doc/content-by-label-macro-145566.html>). When I do this, the documents do not appear in either the page where I placed the Macro or in the preview in the editor. I know these documents exist because that is where the first macro pulled them from.

Does anyone else have the same issue?


Answers:
author: Shannon S
body: Hello, Evan!

I was just working with [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600) when I heard about your issue.

It appears to be related to a bug we have reported in Confluence Server, which is specifically with the search capabilities:

* [CONFSERVER-56163](https://jira.atlassian.com/browse/CONFSERVER-56163) *Searching attachments with filter ancestors will return no results.*

The behavior is very similar; when searching for attachments in Confluence Advanced Search, if you limit to **Pages Under** (Ancestors), then no attachments are found. The same thing doesn't occur if simply search for text.

I was able to replicate this in Cloud too, so I created a bug for that:

* [CONFCLOUD-70485](https://jira.atlassian.com/browse/CONFCLOUD-70485) *Searching attachments with filter ancestors will return no results.*

Unfortunately, there's currently no known workaround for this, other than unchecking the ancestors filter.

Thank you again for reporting this, and I recommend watching the bug so you can be updated of any progress in the future.

Take care,

Shannon

comments: author: Evan Powell
body: Thank you for looking into it! I will watch both bugs.


author: Dominic Lagger
body: Hi [@Evan Powell](/t5/user/viewprofilepage/user-id/4022070)

I have a few questions to get more informations:

1. By documents, do you mean confluence pages or attachments?
2. Did you already tried to find the documents via the confluence search? (See [CQL documentation](https://developer.atlassian.com/server/confluence/advanced-searching-using-cql/#ancestor)). Can you find them in the confluence search?
3. Are the documents really a child of your ancestor page?
4. Do you use other plugins like Scroll Versions?

Thanks for sharing the answers

Regards, Dominic

comments: author: Evan Powell
body: [@Dominic Lagger](/t5/user/viewprofilepage/user-id/601600)

Thanks for the response! To answer your questions...

1.) I mean attachments. Files that I have uploaded to specific pages within the space and labeled.

2.) Just tried it and no, they do not appear. I also went to the attachments in question, clicked on their label, and it showed me all of the attachments with that label as I would assume that the search should have but didn't. I also did the same with other labels throughout the space and the same thing. The search I did was {label = "my_label"}.

3.) Yes, it is the correct ancestor. It is the top-most page of the page-tree for the specific page where the attachments are located. The attachments are in a different ancestor than that of the page where the Content by Label Macro is located, but they are all in the same space.

4.) I am not familiar with Scroll Versions.


author: Dominic Lagger
body: Okay, I can definitely reproduce this behavior (Confluence Server 7.4.1). I didn't found any bugs in the atlassian backlog.

We can clearly see, that the page "Label Attachment" has an attachment with the label "dokuguide"

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/104043i8F916FF13CC4F57B/image-dimensions/325x200?v=v2 "image.png")

And here with the ancestor page "Label Attachment" (which holds the attachment), there is no result:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/104044i1414BFF0E50479D0/image-dimensions/470x287?v=v2 "image.png")

I asked the other community leaders and atlassian members for help.

Regards, Dominic


Tags: cloud

confluence-cloud

content-by-label

macro