Search Box

The Search Box macro adds a search box on a page that lets you fine-tune search within your Confluence spaces.

Instructions

  1. Navigate to the page where you want to add a search box.
  2. Click  Edit.
  3. Click Insert More Content  Other Macros.
  4. Select the  Search Box macro from the Macro Browser.
  5. Customize the search box using the following parameters:

    ParameterDescriptionTypeDefaultRequired

    Space(s)

    Search a specific space, list of spaces, or use keywords to specify spaces @all, @personal, @global, @favourite, @current (default)

    string

    @current

    (error)

    Search all spaces

    Overrides the spaces list above

    checkbox

    unchecked

    (error)

    Filter Last Modified

    Filter the list of spaces by team labels (only the selected space is searched)

    string

    none

    (error)

    Grouping

    Group results by space/type/@select

    single select

    none

    (error)

    Filter Last Modified

    Filter list of search results by last modified date (today/yesterday/lastweek/lastmonth/@select)

    single select

    none

    (error)

    Object Type

    Only return objects of type (page/blogpost/mail/comment/attachment/userinfo

    single select

    none

    (error)

    Global Text Label

    The text to use for labeling global searches

    string

    Global Spaces

    (error)

    Personal Spaces Label

    The text to use for labeling personal searches

    string

    Personal Spaces

    (error)

    Favorite Spaces Label

    The text to use for labeling global searches

    string

    Favorite Spaces

    (error)

    All Spaces Label

    The text to use for labeling global searches

    string

    All Spaces

    (error)

    Search Button Label

    Search Button Label - The text to use for the search button

    string

    Search

    (error)

    Search Input Label

    Adds a label to the search input

    string

    none

    (error)

    Access Key

    Adds an access key to the search button

    string

    none

    (error)

    Show Button

    Display the search button (true/false)

    string

    true

    (error)

    CSS Class

    Option to apply a custom CSS class to the element. Enter the CSS class name(s) to apply to the macro (case sensitive); multiple classes can be separated by a space or comma. Classes must be part of your Global Confluence CSS or defined in a  CSS Stylesheet macro  that you have added to your page.

    string

    none

    (error)

  6. Click Insert. The macro placeholder displays.

  7. Save the page to view the rendered search box.

Examples

Search the current space

Search Box macro added with default parameters.

A rendered Search Box macro added with default parameters.

Search a specific space

Search Box added with Space parameter set to "ADAPTAVIST".

There’s no visual distinction between this search box and the one in the previous example, so it should be indicated on-screen that the search box is searching a different space.

The Space parameter value is case-sensitive. It must be the same as the Space Key. In our example above, if we used Adaptavist, the search would not work properly.

Specify multiple spaces

Create a search box to search a specific space as follows:

With Space parameter set to "SUP, PROD".

Search all spaces

Create a search box that searches all spaces as follows:

With Search all spaces checkbox "checked".
[source,html]

Improved layout

Using a search box on its own won't tell your users what they are searching. Using macros such as the Panel and Center macros, an improved search panel can be created:

A default Search Box macro contained in a Center macro within a Panel macro.

The search allows a user to search only in spaces for which they have sufficient view privileges.

Advanced  Search Query Syntax  can be used within the search box if required.


If you are still stuck please contact our support team who can offer you more assistance. 
You can try our full range of content formatting macros for free by visiting the Marketplace.
On this page