Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to find pages in Confluence with only one label?

Elena_Lurye December 3, 2015

Hi,

I am trying to find pages with only one label attached to it (we have to encourage users to provide more than just  label predefined by the template). Is there a way to accomplish that? I am using the below search trying to find pages with label "how-to" and nothing besides that, but it shows me pages with no labels as well as the ones I expect.

(type: page labelText:”how-to”) AND (type: page NOT labelText:[a TO g]) AND (type: page NOT labelText:[i TO z]) AND (type: page NOT labelText:[0 TO 9])

 

Plus, it lists not only pages with "how-to" label - it also lists pages where "how-to" is part of the longer label name - like "kb-how-to-article"

1 answer

1 accepted

0 votes
Answer accepted
Andy J.
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 4, 2015

Hi Elena,

You should be able to do this through the database side. Do you know if you have access to the database (this may vary if you are using Confluence Cloud or Confluence Server). I was able to get all pages that have only 1 label using the following SQL query. Note that this is syntax for PostgreSQL but should be similar (if not exactly the same) for other database flavors. This should give you a good start in getting the details you need.

 

SELECT c.title as PageTitle, count(title) as NumberOfLabels from content_label cl inner join label l on cl.labelid = l.labelid inner join content c on c.contentid = cl.contentid
where  cl.labelabletype = 'CONTENT'
group by c.title
having COUNT(c.title) = 1;

Andy Jean 

 

Elena_Lurye December 4, 2015

Thank you! I should get a database access shortly - will try that

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events