limiting search box to a space by default

My name is Karis, I work for Harvard Business Publishing (HBP) and I have recently been promoted to creating and maintaining a Knowledge Base for the customer facing support department. HBP has an installation of Confluence and many different groups within the company have spaces. We are using our space (called Customer Service) within the company wide Confluence installation to house the Knowledge Base of which I'm in charge. I'm giving you this background so that you understand context for my question.

I need to limit the search box that appears in the upper right on every page by default: I need to limit this search box to only search our Customer Service space - but - and I think this is the key, I need to set this default for only our space. As in, the Marketing group has their own space and I don't want to limit the search box in their space to only searching within their space, but I do want to set this restriction on the search box on pages within our space. Does my request make sense? Is it possible?

4 answers

1 accepted

This widget could not be displayed.

Karis, this cuztomization requires you to use it under the HTML macro:

https://confluence.atlassian.com/display/DOC/HTML+Macro

You can try the following cuztomization with on your page/space:

<form method="POST" action="/dosearchsite.action" name="searchForm" style="padding: 1px; margin: 1px">
<input type="hidden" name="quickSearch" value="true" />
<input type="hidden" name="searchQuery.spaceKey" value="spacekey" />
<input type="text" accessKey="s" name="searchQuery.queryString" size="25"/>
<input type="submit" value="Search Space Name"/>
</form>

Replace the value of "spacekey" in the searchQuery.spaceKey hidden item for the space key of your space.

You only need to insert it through the desired page/space and then replace the name="searchQuery.spaceKey" for name="searchQuery.The Space Key of your Space".

In example, I have a space named "Careful With That Axe, Eugene" and the spacekey for it is CTE. I've replaced the SearchQuery to name="searchQuery.CTE".

Hope it helps you, Karis.

All the best for you.

Thanks. Is it easy to modify that to cover (a) a number of spaces or (b) spaces having a certain space category tag?

This widget could not be displayed.

Hi,

It turns out this functionality already exists. I'm kind of disappointed, given the ease of the solution, that no one knew about it. Hopefully this helps others.

Thank you so much for sharing this! I was looking for this exact solution, and you seem to be the only one mentioning, that such a feature exists. For everyone else looking for this feature, you'll find it navigating to "Browse" > "Space Admin" > "Themes" > "Configure theme" > "Limit search results to the current space"

As a space admin I'm unable to find this in version 5.7.3 of Confluence. There's a Themes tab under Look and Feel but there's no Configure option.

I believe that, under Themes, you must choose "Documentation Theme". After that you get the Configure option. (This is why I always use the Documentation Theme. I have observed no or almost no negative side-effects of it.)

@Mikael Mikkola Thank you!

That was very well hidden... It works however I had to change color scheme and somehow my sidebar does not display our space logo so it's harder to navigate to space home page. I hope I can fix this by manually editing the custom sidebar wiki markup (Themes > Navigation).

Big fan of limiting search to current space. Only problem is the Documentation theme seems to get less attention from Atlassian. Check out https://jira.atlassian.com/browse/CONF-5338 

I used this setting for awhile and it was great. Then my space was auto updated to a new theme that doesn't have this setting. It's very irritating.

This widget could not be displayed.

Hi all,

I tried above solution but it doesnt work. I have injected following htmls in form section of search box

<input type="hidden" name="quickSearch" value="true" />
<input type="hidden" name="searchQuery.TP" value="spacekey" />

"TP" is my space key.
I am using Confluence 5.4.3.

I also want user to search with in sapce not in all available space.
Any help is appreciated...

Thanks in advanced

This widget could not be displayed.

An alternate solution is to remove the (global) Quick Search from the header bar and add the Livesearch macro to the Sidebar, Header or Footer. This takes up a little more space, but including the search in the sidebar intuits that you are searching the space tree so we like locating it there.

Remove the Quick Search:

  1. goto Space tools/Space Stylesheet
  2. Edit
  3. Enter the text below and save
#quick-search{
    display:none;
}                 

 Add Live search:

  1. goto Space tools/Sidebar, header and footer
  2. Enter text below whereever you want it to appear
{livesearch:spaceKey=YOURSPACEKEY|placeholder=Search this here space}

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 17, 2018 in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

627 views 8 6
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