Extension:SearchParserFunction

The SearchParserFunction extension adds a parser function to search, format and display search results in wiki pages.

Basic usage
This will search for pages that contain "foo" (in their text) and return the results as a list of links, like so:


 * Foo
 * Bar
 * Baz

If you're using Extension:CirrusSearch, you can use all available search operators (see Help:CirrusSearch). For example:

Parameters
This extension calls the Search API internally and most of the parameters correspond to API parameters (but without the "sr" prefix). Read the Search API documentation for details.


 * - Either 'text', 'title' or 'nearmatch', defaults to 'text'
 * - See Manual:Namespace constants, defaults to 0 (mainspace)
 * - Max number of results, defaults to 10
 * - Sorting criteria, defaults to 'relevance'
 * - Format of the search results (see below), defaults to 'list'

List
Returns an unordered list (  ) of search results, linked to their pages. For example:


 * Foo
 * Bar
 * Baz

Count
Returns the total number of search results as a plain number.

Plain
Returns a comma-separated list of plain titles, for example:

Foo, Bar, Baz

This format is designed for further processing. For example, using the #arraymap function of Extension:PageForms:

This would output the search results one below the other and linked to their pages, like so:

Foo Bar Baz

Template
Returns the search results wrapped in a template. All search result properties are passed on to the template and may be used or ignored. See the Search API documentation for the list of properties.

For example, a template named "Search result" could contain the following:



Then a query like the following:

Would return the search results with some styling, the title linked to the page and the snippet below, like so:

Foo Foo is a generic term widely used to refer to any computer entity whose name is unknown or does not want to be expressed. Bar Bar is also a generic term widely used to refer to any computer entity whose name is unknown or does not want to be expressed. Baz Baz is also a generic term widely used to refer to any computer entity whose name is unknown or does not want to be expressed.