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

limiting search box to a space by default

Deleted user Oct 17, 2012

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

0 votes
Answer accepted

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?

Could this be modified, restricting empty space keys, in order to prevent that questions are visible to everybody?

4 votes
Deleted user Jan 07, 2013

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"

Like cweiske likes this

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 

Like cweiske likes this

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.

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

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
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

67 views 3 5
Join discussion

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