Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to filter the search with labels Edited

I need a search plugin, which only searches for Pages with a specific label.

In livesearch plugin it works fine, but only in the dropdown as livesearch. As soon as I klick ok, it shows all pages, without the filter.

The users can do it manually with labelText:xxx". However I need sthg to do it autmatically.

I hope someone could help me with the issue


1 answer

Are you on Server or Cloud?

For Server, there is Canned Search for Confluence (although it's a bit expensive)

For Cloud, I'm considering adding this feature to the existing CQL Search addon.

Server, but it's too expensive. Thanks for the answer.

Hi Ayse,

I spent some more time and thought I would write some small code to solve your issue. If you place this code in your custom HTML:

AJS.toInit(function() {
 $("form[name=livesearchForm]").each(function() {
  if ($(this).find("input[name=labels]").val()) {
   $(this).find("input[name=queryString]").on("keyup", function() {
    var input = $(this).val();
    var livesearchForm = $(this).parent().parent().parent();
    var label = livesearchForm.find("input[name=labels]").val();
    var spaceKey = livesearchForm.find("input[name=where]").val();
    var newLink = "/dosearchsite.action?cql=siteSearch+~+\"" + input + "\"+and+label+%3D+\"" + label + "\""
    if (spaceKey !== "conf_all") {
     newLink += "+and+space+%3D+" + spaceKey;
    livesearchForm.attr("action", AJS.params.contextPath + newLink);
    setTimeout(function() {
     var moreLink = livesearchForm.prev().find("");
     moreLink.attr("href", AJS.params.baseUrl + newLink);
    }, 500);

then it will change the behavior of the livesearch macro so that it filters based on the label in the main search as well (and also takes the space filter into account, if set).

If you don't want this to be active on all pages, then you could put it inside a user macro (just add ## @noparams to the top) and then add that user macro to the pages with the livesearch macro.

Hi @Stephen Deutsch ,

Can you provide screenshots for this configuration that you mentioned above? Appreciate your help on this.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Miss the Confluence demos at Team 21? Watch them here!

Phew, Atlassian Team 2021 blew by. With dozens of demos and a handful of keynotes, you may have missed some of the awesome Confluence Cloud sessions. Don't' worry, you can watch them all here or on Y...

201 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you