Search Results Macro

Still need help?

The Atlassian Community is here for you.

Ask the community

The Search Results macro searches your Confluence site based on search terms specified in the macro parameters, and displays the results on the wiki page.

Using the Search Results macro

To add the Search Results macro to a page:

  1. In the Confluence editor, choose Insert > Other Macros
  2. Find and select the required macro

Speeding up macro entry with autocomplete: Type { and the beginning of the macro name, to see a list of suggested macros. Details are in Autocomplete for links, files, macros and mentions.

To edit an existing macro: Click the macro placeholder and choose Edit. A macro dialog window will open, where you can edit the parameters of the macro.

Parameters

Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).

Parameter

Default

Description

Search Terms
(query

none

The search terms which this macro will use to generate its results.

You can refine your search query by using operators such as 'AND' and 'OR'. For example: my_query1 AND my_query2

For more information, take a look at the documentation on the Confluence search syntax.

Maximum Number of Results
(maxLimit

10

Set a limit to the number of search results displayed.

Restrict to this Space Key

all

Start typing the space name to find the space, or specify the key of the space you want to search in. Note that the key is case sensitive.

Content Type
(type

all

Specify the content type. The content types are: page, comment, blogpost, attachment, userinfo (the content of user profiles only) and spacedesc (the content of space descriptions only).

Last Modified
(lastModified

all

Specify a period of time in weeks, days, hours and/or minutes, to see the content modified within that time frame.

These are the values you can use:
  • w = weeks
  • d = days
  • h = hours
  • m = minutes

For example:

  • 2h 35m
  • 3d 30m

Notes:

  • If no time category is specified, Confluence assumes minutes.
  • If you specify more than one time period (for example, weeks and days), you must separate the periods with a space. You can put them in any order.
  • The time categories are not case sensitive. For example, '4d' is the same as '4D'.

Restrict to this Username
(contributor

all

Specify the username of a Confluence user, to show only content created or updated by that user.

Notes

Permissions: When a user views the page containing the Search Results macro, the search results will show only pages and other content types for which the user has 'View' permission.

 

Code examples

The following examples are provided for advanced users who want to inspect or edit the underlying markup for a Confluence page. 

Macro name: search

Macro body: None.

Storage format example

<ac:structured-macro ac:name="search">
  <ac:parameter ac:name="lastModified">3w</ac:parameter>
  <ac:parameter ac:name="query">choc</ac:parameter>
  <ac:parameter ac:name="contributor">
    <ri:user ri:userkey="1235678912345678912345678912345"/>
  </ac:parameter>
  <ac:parameter ac:name="maxLimit">10</ac:parameter>
  <ac:parameter ac:name="type">page</ac:parameter>
  <ac:parameter ac:name="spacekey">
    <ri:space ri:space-key="ss"/>
  </ac:parameter>
</ac:structured-macro>

Wiki markup example

{search:lastModified=3w|query=choc|contributor=admin|maxLimit=10|type=page|spacekey=ds}
Last modified on Dec 2, 2015

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.