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"
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
Thank you! I should get a database access shortly - will try that
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.