Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How find pages without a specific label in Confluence?

Dmitry Andrejev
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.
September 29, 2015

Hi,

I want to find pages that have "label-a" but don't have "label-b".

The advanced search form allows to search for label presence by adding "+labelText:label-a", but searching for label absence using "-labelText:label-b" doesn't seem to be working.

 

Also in each case I'm required to enter a keyword for search, but since I want to find all pages I get no search results because of missing keyword.

 

Thanks.

2 answers

1 accepted

1 vote
Answer accepted
Stephen Deutsch
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.
September 29, 2015

Sorry, I forgot that Confluence label searching sort of has a bug: if you search for a label that has a dash in it, it only searches for part of the label.  Therefore, when we were searching for "task-related", it was matching any labels that contained the word "task".

If you search for labelText:"task-created" NOT labelText:"task-resolved" (with the quotes) then it works properly.

Dmitry Andrejev
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.
September 29, 2015

Yes, that is what I needed. Big thanks. This is final search query I've used: labelText:"task-created" NOT labelText:"task-resolved"

Martin Cleaver
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 18, 2019

Is this bug still the case? Do you have the issue ticket?

Martin Cleaver
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 18, 2019

https://confluence.atlassian.com/doc/confluence-search-syntax-158720.html says

Searches for content containing a specific label. If the label has a hyphen, include it within double quotes.

labelText:roadmap

labelText:"product-roadmap"

0 votes
YouriDS September 29, 2015

Hello

Use the NOT operator.

type:page labelText:label-a NOT labelText:label-b
Dmitry Andrejev
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.
September 29, 2015

Thanks, but that doesn't work. Here is where I use it: http://community.in-portal.org/dosearchsite.action?queryString=type%3Apage+labelText%3Atask-created+NOT+labelText%3Atask-resolved 1. the "Type" in sidebar on the left still says "All Content" even though I've searched for pages only (maybe pages only are found) 2. the 1st found page doesn't have any label at all. I've tried to add "AND" before "NOT" but that resulted in no pages found.

Stephen Deutsch
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.
September 29, 2015

It seems like that's because all pages that have the "task-created" label also have the "task-resolved" label. Searching for each label individually shows 2011 results for both.

Dmitry Andrejev
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.
September 29, 2015

That's not true as well. There following group of pages (I'm certain): - ones, that don't have any label - ones, that have label other then "task-created" or "task-resolved" - ones that have "task-created", but not "task-resolved" - ones that have both "task-created" and "task-resolved" Fact, that page with no labels were also found proves, that suggested search query doesn't search what it's supposed to.

Stephen Deutsch
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.
September 29, 2015

that's because you have the type:page attached to the search, you should remove that part or include an AND after it. If you don't include AND, the space is interpreted as "OR". Notice that if you search for "labelText:task-created AND labelText:task-resolved", then you also get 2011 results. This leads me to believe that there are no pages that have "task-created" but do not have "task-resolved"

Dmitry Andrejev
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.
September 29, 2015

bq. that's because you have the type:page attached to the search, you should remove that part or include an AND after it. If you don't include AND, the space is interpreted as "OR". http://community.in-portal.org/dosearchsite.action?queryString=type%3Apage%20AND%20labelText%3Atask-created%20NOT%20labelText%3Atask-resolved&startIndex=0&where=conf_all is using "type:page AND labelText:task-created NOT labelText:task-resolved" as you suggested, but shown no pages, which is incorrect as well. See why in next comment. bq. Notice that if you search for "labelText:task-created AND labelText:task-resolved", then you also get 2011 results. This leads me to believe that there are no pages that have "task-created" but do not have "task-resolved" If I list pages by label: * http://community.in-portal.org/label/task-created - 128 pages (x10 results per page) * http://community.in-portal.org/label/task-resolved - 117 pages (x10 results per page) So totally not the same pages :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events