Search for labels with prefix on a confluence page

Suresh Venkat October 13, 2021

Hi,

I would like to search for pages with labels which are prefix with say characters OTB or otb. For example if page 1 has label OTB_First and page 2 has label otb_second, my search (CQL or Confluence search) for any page starting with OTB or otb, should give me 2 pages or even if give me labels - should give me OTB_First , otb_second

Any ideas?

Thanks,

Suresh

3 answers

0 votes
Nicolai Sibler
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, 2021

Hi @Suresh Venkat ,

if you have the possibility to run a query against the database, here's your SQL:

SELECT c.title,s.spacename,l.name as label
FROM content c
JOIN spaces s ON s.spaceid = c.spaceid
JOIN content_label cl ON cl.contentid = c.contentid
JOIN label l ON l.labelid = cl.labelid
WHERE l.name LIKE 'otb%'
AND c.contenttype = 'PAGE'
AND c.prevver IS NULL;
Suresh Venkat October 15, 2021

@Nicolai Sibler : We are looking at how to display it on a page. Is there anyway, we can fire this query from a confluence page - may be via an REST/Macro. Do you know? Thanks for the query though.

Nicolai Sibler
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, 2021

Complementary to what Kishan said, you might also have a look at some Plugins. (I have no experience with any of them tbh.)

Like Kishan Sharma likes this
0 votes
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2021

Hi @Suresh Venkat If you have access to the database, the easiest way to find this information is through the database. (Make sure you have a backup of your database before performing any SQL query.) Refer this link on a sample query which you can modify as per your needs.

Suresh Venkat October 15, 2021

@Kishan Sharma : As you can see, we are looking to search and display on a page via a Macro or CQL. Any help can be provided will be appreciated 

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2021

As Brant mentioned, wildcard search for labels is not possible through the user interface currently. Either, you can export the query output from the database, and attach it to the confluence page or create a page using REST API and provide the exported output from the db query as an input (in json format) to the rest call.

0 votes
Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 13, 2021

@Suresh Venkat There is not a wildcard search for labels available in Confluence or Jira.  I was able to find an enhancement request for Jira but not for Confluence.  I would suggest submitting one here. https://jira.atlassian.com/secure/Dashboard.jspa

Suresh Venkat October 15, 2021

@Brant Schroeder : Thanks for the inputs. Can you please point us to the Enhancement that you have put in for Jira. We want to see, if it matches to our case. 

Brant Schroeder
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2021

@Suresh Venkat The enhancement request I was able to find for Jira is here: https://jira.atlassian.com/browse/JRASERVER-23038

Suresh Venkat October 15, 2021

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events