Can I limit a search in the global search box to a certain space?

In Confluence, is there any way to limit a search in the global search box to a specific space? 

E.g., SPACEKEY: searchTerm

I am building a glossary space and I want people to be able to search for a term from anywhere in Confluence and have it come up prominently in the search results. So a search might look like this - GLOSSARY: widgit

This would be prefereable to making them navigate to the Glossary space and then perform their search.

Maybe there is an add-on that provides this functionality?

Thank you.

3 answers

1 vote
Davin Studer Community Champion Oct 06, 2014

If you look at the source for the form you will see a hidden input like this ...

<input type="hidden" name="where" value="">

the value should be either conf_all or the space key you want to search. You could set it with this...

<script type="text/javascript">
	AJS.toInit(function(){
		AJS.$('#quick-search input[name="where"]').val("conf_all");
	});
</script>

Thank you for the response Davin. The problem then becomes that ALL searches would be limited to the space defined (i.e., glossary). I want people to be able to perform global searches for content as normal, but restrict the search to the glossary space when they specifically want to search for a glossary term.

Davin Studer Community Champion Oct 06, 2014

Ok. If you set it to global search (conf_all) then you can put "stuff AND spacekey:???" in the search field and you should get the results only for that space.

1 vote
Boris Berenberg Community Champion Oct 06, 2014

There isn't a great way to do this. What you can do is to configure the documentation theme to restrict search within the space the user is viewing. Take a look at: https://confluence.atlassian.com/display/DOC/Using+the+Documentation+Theme#UsingtheDocumentationTheme-Searchingthespaceorthesite For this to work in your scenario, the user would have to be within the GLOSSARY space to begin with. You could also put GLOSSARY into the page name, and then use that as part of the search to make it more accurate?

Thank you Boris. I was hoping to streamline the glossary search so a user wouldn't have to navigate to the glossary space before performing their search. If they have to navigate to the space first, they can just use the existing space search box in the left nav, or i can put a space search box on each page in the glossary. Either way, this requires several clicks in the workflow to get to the term search: 1) Click on Spaces 2) Select Space Directory 3) Filter for Glossary 4) Click on Glossary 5) Enter Search term in the left nav search box (of course, this may be short-cutted a little for savvy users who use favorite spaces or bookmarks - but we can't rely on that) The workflow I would like to see is this: 1) Go to the global search box at the top any confluence page and enter GLOSSARY: yourSearchTerm - while maintaining the ability to perform global content searches by omitting 'GLOSSARY:' from the search query. It seems like the ability to use a SPACEKEY in the global search would be a useful feature.

Boris Berenberg Community Champion Oct 06, 2014

I totally agree with you and encourage you to file a suggestion for this at: https://jira.atlassian.com/

Gary -

Unless I am misunderstanding what you are asking, there is not an add-on BUT this is not a very hard plugin to adjust the global search bar to work this way, where it defaults to all spaces, but has perhaps a dropdown to select a space (i.e., glossary, etc.).. 

Or - put the livesearch macro in a central page. Type:

{livesearch}

in the page. Save the page. Edit it, and double click on the macro to edit additional parameters including a space key if want to limit (All the parameters are defined here - if you want to do direct using the "insert wiki markup" option.)

It this really bugs you or your users - we can create that "plugin" with UX modification as described in your Confluence system for you quickly. info@appfusions.com Know that as a separate plugin, it will not affect your upgrades, but might require modification between upgrades.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

698 views 21 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you