Search content of a single space in confluence

How to search content of a single space in confluence that uses zen foundation theme

2 answers

1 accepted

you could create your own search box, either using the HTML macro or if you want to make it a little more usable, a user macro. you then just drop in {search-current-space} in the page.

## Macro title: Search Current Space
## Macro Name: search-current-space
## Macro has a body: N
## Body processing: No Macro Body
## Output: HTML
##
## Developed by: Matthew Cobby
## Date created: 26/07/2011
## Installed by: Matthew Cobby

<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="$space.getKey()" />
<input type="text" accessKey="s" name="searchQuery.queryString" size="50"/>
<input type="submit" value="Search Space"/>
</form>

what you are trying to do is create an HTML form in the page like this:

<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 OF CURRENT SPACE**" />
<input type="text" accessKey="s" name="searchQuery.queryString" size="25"/>
<input type="submit" value="Search Space"/>
</form>

if you wanted, you could add extra parameters to the macro to search types of content, date ranges, formatting rules etc

That's true and yours is a much cooler solution, Matthew. But can OnDemand users create their own macros (or install their own plugins)?

ahh, my bad. I thought they now allowed some user macros but obviously not, it's still a restricted function. However, if you use the documentation theme, there is an option to restrict the search box in the top right to the default space

https://confluence.atlassian.com/display/AOD/Searching+Confluence#SearchingConfluence-SearchOptionsWhenUsingtheDocumentationTheme

You can then do it on a space by space basis.

You could reate a 'Search this space' landing page and add a search box macro to the page

Note, I don't know if the macros still exist in 4.x -- but that's how I would do it in 3.5x

Update: Sorry, I should have said a "Page Tree Search" macro. You have to specify the home page.

the only problem is that it misses out a lot of content, it won't search anything not under the home page, or other content like blog posts

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,804 views 26 10
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