Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Limit Confluence header search to the current space

Nick Sills June 27, 2019

Hi 

 

We're trying to improve our customers experience when using our KB here:

https://knowledgebase.macrium.com/

 

1. Unfortunately the search bar in the page header returns results across all Spaces, We need to limit the search to the current space only.

Also...

2. Searches match on whole words only. Is it possible to match on partial?

 

Thanks for your help

1 answer

0 votes
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2019

Hey Nick,

For limiting search, I'd recommend adding a Livesearch macro to either your KB's homepage, or in the header for your space. The parameters of the macro let you restrict results to a particular space. Documentation showing how to set it up is here.

As an example of this, I've gone to the Space SettingsLook and FeelSidebar, header and footer and added the following to the header section:

{livesearch:spaceKey=TEST|size=large|placeholder=Search the KB}

This gives me a livesearch at the top of every page in the space, limited to that space:

image.png

In terms of matching partial words, you'll need to use the wildcard character (the asterisk - *). Users will have to include this in their search string (there's no out-of-the-box way to include it by default). Here's an example of the livesearch returning a partial match:

image.png

Cheers,
Daniel

Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 28, 2019

Additionally - you might find this thread of interest, specifically John Corwith's answer where he suggests using the Custom CSS for the space to also just hide the global search bar:

#quick-search{
    display:none;
}                 
Nick Sills June 29, 2019

Thanks for the replies but we want to directly change the function of the header bar search not remove it. or add a different one at the top of each page.  

Adding a search using Look and Feel > Sidebar, header and footer wastes vertical space on the page. 

Removing the search from the header bar would be preferable as the sidebar has a space restricted search already,*but* the CSS doesn't appear to work and, more importantly, removing the search would break the search on mobile as there's no sidebar there. 

Is there any way to directly modify the existing search on the header bar?

Thanks

Nick Sills June 29, 2019

I managed to hide the header bar search by adding the following to the Space CSS:

.aui-header .aui-quicksearch {
display: none;
}

This is OK when browsing on a PC because the there's a search on the side bar. However, on mobile the only search is in the hamburger menu. I thought that by hiding the search on the header that this would also hide the mobile search, but it didn't.

Unfortunately the mobile search is still across all spaces. 

Is there any way to modify the CSS or/add change the search behavior for the mobile site? The mobile site menu bar is totally inappropriate. 

Thanks for your help 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events