How to search Confluence for usage of a macro

Guest Blogs - Techwriter News

Do you need to find all pages on your Confluence site that use a given macro? You can do it via the Confluence search. Here’s how, in Confluence 4.0 and Confluence 3.5.

Confluence 4.0

Enter the following in the Confluence search box, assuming that your macro name is “x”:

macroName: x*

For example, let’s say that you want to search for all “include” macros:

macroName: include*

Or let’s say that you want to search for all “excerpt-include” macros:

macroName: excerpt-include*

Notes:

  • The key word is case sensitive. It must be “macroName”, and not “macroname” or any other variation.
  • There is a space between the colon and the macro name.
  • The macro name (x, include, excerpt-include, and so on) is the value that you supply in wiki markup. (It is the name of the macro as defined in the “atlassian-plugin.xml” file.)
  • The asterisk at the end of the macro name is required, to ensure that the search picks up all references. (Evidently the reason for this is that the value in the query is stemmed, but the value in the Lucene index is not stemmed. The asterisk will prevent the stemmer from kicking in.)
How to search Confluence for usage of a macro

Searching for a macro in Confluence 4.0

Confluence 3.5

In Confluence 3.5, you can enter the curly brackets and the macro name surrounded by double quotation marks, like this:

“{excerpt-include”

Or this:

“{children”

Or even this, to find all occurrences of the include macro that include a given page:

“{include:my page name”

The trouble is that this will pick up all occurrences of the search term, both with and without the curly brackets.

As an alternative, try this plugin, which provides a user interface for a Confluence 3.5 macro search: The Macro Usage plugin. It is not (yet) compatible with Confluence 4.

Thank you

Thank you to Daniel Kjellin, the Confluence developer who wrote the Confluence 4.0 macro usage search, and who told me all about it! I just discovered it today. I hope you find it useful too.


How to search Confluence for usage of a macroHow to search Confluence for usage of a macro

Read more http://ffeathers.wordpress.com/2011/11/04/how-to-search-confluence-for-usage-of-a-macro/