Template documentationedit documentation
Use this template to search and display search results in a wiki page.
Parameters[edit source]
1
orquery
- Required! Search query. See mw:Help:CirrusSearch for all available search operators. For example:water
- Search all pages with "water" in the text or title-water
- Search all pages without "water" in the text or titleintitle:water
- Search all pages with "water" in the title-intitle:water
- Search all pages without "water" in the titleincategory:Water
- Search all pages in Category:Water-incategory:Water
- Search all pages not in Category:Waterlinksto:Water
- Search all pages that link to Water-linksto:Water
- Search all pages that don't link to Waterinlanguage:es
- Search all Spanish pages-inlanguage:en
- Search all non-English pageshastemplate:Page_data
- Search all pages with Template:Page data-hastemplate:Page_data
- Search all pages without Template:Page datasubpageof:Water
- Search all subpages of Water-subpageof:Water
- Search all pages that are not a subpage of Water
namespace
- Namespace to search, defaults to the main namespace. For example:namespace=2
- Search user pages (see namespace numbers)namespace=*
- Search all namespaces
limit
- Max number of results, defaults to 10. For example:limit=100
- Limit to 100 search resultslimit=max
- Maximum allowed number of results (5000)
sort
- Sort criteria, defaults to 'relevance'. Allowed values:sort=create_timestamp_asc
- Oldest pages firstsort=create_timestamp_desc
- Most recent pages firstsort=incoming_links_asc
- Least linked pages firstsort=incoming_links_desc
- Most linked pages firstsort=last_edit_asc
- Most recently edited pages firstsort=last_edit_desc
- Least recently edited pages firstsort=random
- Random sortingsort=relevance
- Sort by relevance as determined by the search engine
format
- Format of the search results, defaults to 'list'. Allowed values:format=list
- Return an unordered list (<ul>) of search results, linked to their pagesformat=card
- Return pretty search cards (see Template:Search results/card)format=count
- Return the total number of search results as a plain numberformat=plain
- Return a comma-separated list of plain titles for further processingformat=json
- Return a JSON object for further processing, for example in a Lua module
Examples[edit source]
Basic[edit source]
{{Search results|panel}}
Search operators[edit source]
{{Search results|panel incategory:Photovoltaics linksto:Solar_energy}}
Parameters[edit source]
{{Search results|panel|limit=5|sort=create_timestamp_asc}}
Card format[edit source]
{{Search results|panel|format=card|limit=5}}
Search in more than one category[edit source]
Searching the term 'water' in pages that belong to both Category: Projects and Category:Literature reviews:
{{Search results|water incategory:"Projects" incategory:"Literature reviews"|limit=5|format=list}}
Template data[edit source]
Use this template to search and display search results in a wiki page.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Query | 1 query | Search query
| String | required |
Namespace | namespace | Namespace to search (use * for all)
| Number | optional |
Limit | limit | Max number of results (use 'max' for maximum allowed)
| Number | optional |
Sort | sort | Sort criteria
| String | optional |
Format | format | Format of the search results
| String | suggested |
Class | class | Additional CSS class
| String | optional |
See also[edit source]
- Template:Search - Create smart and friendly links to search results
- mw:Extension:SearchParserFunction - Extension on which this template is based
- mw:Help:CirrusSearch - Advanced search features