Advanced Search with CirrusSearch Extension in MediaWiki
A hands-on reference to the CirrusSearch query language: filters, prefixes, date ranges, sorting and real examples for MediaWiki search.
CirrusSearch is MediaWiki's Elasticsearch/OpenSearch-backed search engine — the same one Wikipedia runs. The query language is what separates 'search that works' from 'search that finds things'. This is the hands-on syntax reference (installation and operation are covered in the companion guide on this blog). All keywords are lowercase and case-sensitive.
Basics: words, phrases, wildcards
- Plain words:
parser extension— matches all terms, ranked by relevance - Quoted phrases:
"exact phrase"— disables stemming, matches exactly - Wildcards:
wik*edia(any characters),wik?pedia(one character); a wildcard cannot match the first character of a word - Fuzzy:
mediawiki~1(word-level),"exact phrase"~2(phrase proximity) - Negation:
-spamexcludes pages containing the term
Filters
intitle:Foo page title contains Foo
incategory:Books pages in the Books category (or subcategories via deepcat:)
linksto:Foo pages linking to Foo
hastemplate:Infobox pages transcluding the template
inlanguage:de page language filter
prefix:User pages whose name starts with User
subpageof:Foo subpages of Foo
contentmodel:wikitext restrict by content model
Filters chain naturally, and every one restricts the candidate set — which is also the performance rule: add a filter before adding complexity.
Searching the source: insource
insource:"{{Infobox" finds template calls
insource:/regex pattern/ regular expression match
insource: searches raw wikitext — the tool for 'which pages still use the old template' and other source-level audits. Plain regex needs the optional search-extra plugin; without it, quoted substrings still work.
Dates
creationdate:2025-09-01 pages created that day
lasteditdate:>today-30d edited in the last month
creationdate:>=2024 creationdate:<2025 created during 2024
Date filters combine two filters for ranges; now-1h, today and now-1y style expressions are supported.
Files
filetype:png file type filter
filemime:image/png MIME filter
filesize:>20 size in kilobytes (20 = 20 KB)
More like this
morelike:Foo|Bar finds pages sharing significant terms with the given pages — research discovery and orphaned-content hunting. Available in the API too (action=query&list=search&srsearch=morelike:...).
Ranking and sorting
prefer-recent:1y— decay older pages' scoresboost-templates:"Template:Important|200%"— favor pages transcluding certain templates- Explicit order via the results URL:
&sort=last_edit_desc(alsocreate_timestamp_desc,incoming_links_desc,random,title_natural_asc; API callers usesrsort); sorting disables score-based keywords
Example queries
// All books by a specific author, newest first
incategory:Books "specific author"
// Templates still using the old infobox
hastemplate:Infobox old infobox
// Recently edited user pages about the API
prefix:User API lasteditdate:>today-90d
// Files larger than 5 MB named 'map'
filetype:png filesize:>5000 intitle:map
Pitfalls
- Keywords are case-sensitive —
INCATEGORY:does not work - Underscores vs. spaces:
prefix:User Foo_Bartreats_as part of the word — use quotes for multi-word values (incategory:"Foo Bar") - The search suggestions (autocomplete) index updates roughly daily, while full-text results update within minutes — don't diagnose bugs across the two
The full reference is Help:CirrusSearch on mediawiki.org — including logical operators, proximity details and language-specific behavior. The 15 minutes learning the filters repay themselves in every search you stop clicking through.