limiting search box to a space by default

Deleted user October 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
Giuliano C_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 28, 2012

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.

Mikael Mikkola February 18, 2016

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

Contact IT October 24, 2019

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

Maren Woldag December 7, 2020

Hi @Giuliano C_ 

Thanks a lot for the HTML Code.

 

Would it be possible to Add two spaces in the Value Parameter, as I need to limit the search to two different spaces (not possible with any other makro)

Thanks so much for your reply!

4 votes
Deleted user January 7, 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.

Simon Hugentobler November 17, 2014

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
Anders Nordbø January 11, 2016

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.

Mikael Mikkola February 18, 2016

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.)

Anders Nordbø February 22, 2016

@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).

Tim Colson March 4, 2016

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
listed address May 25, 2016

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.

0 votes
John Corwith September 7, 2017

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}
0 votes
sanket pathre April 17, 2014

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events