| Note: When you edit this page, you agree to release your contribution under theCC0. SeePublic Domain Help Pages for more info. |
The quickest way to find information in Wikimedia projects is to look it up directly. On every page there is asearch box.
CirrusSearch is a MediaWiki extension that usesOpenSearch to provide enhanced search features over thedefault MediaWiki search.The Wikimedia Foundation uses CirrusSearch for allWikimedia projects.This page describes the features of CirrusSearch.If your question is not answered here, feel free to ask on thetalk page and someone will answer it for you.
For information on the MediaWiki extension, seeExtension:CirrusSearch.
For its use on Wikidata, seeHelp:Extension:WikibaseCirrusSearch.
Enter keywords and phrases and press↵ Enter orReturn on your keyboard or click the magnifying glass icon, "Search", or "Go" button.
If a page has the same title as what you entered, you will be directed to that page.Otherwise, it searches all pages on the wiki, and presents a list of articles that matched your search terms, or a message informing you that no page has all the key words and phrases.
If you click the "Search" button without filling in anything, you will be taken toSpecial:Search which gives you extra searching options (also available from any search results list).
You may find it useful to restrict a search to pages within a particularnamespace, e.g., only search within the User pages.Check the namespaces you require for this search.
CirrusSearch features three main improvements over the default MediaWiki search, namely:
There are two primary search indexes to consider:
The first is full-text search, on Special:Search.This index is updated in near real time.Changes to pages should appear within a few minutes in the search results, but 30 minutes is still considered normal operation.Changes to templates should take effect in articles that include the template in a few minutes, taking up to several hours depending on the number of pages using the template.Anull edit to the article will force the change through, but that shouldn't be required if everything is going well.
The second index to consider is the fuzzy auto-complete title search.This index is updated once a day and mirrors what was found in the full-text search index at the time the index was updated.Depending on timing a new page could take two days to be found in the fuzzy title autocomplete.If this is unacceptable for a particular use case, withinuser search options the title completion can be changed to classic prefix search which uses the full-text search index.
The search suggestions you get when you type into the search box that drops down candidate pages is sorted by a rough measure of article quality.This takes into account the number of incoming wikilinks, the size of the page, the number of external links, the number of headings, and the number of redirects.
Search suggestions can be skipped and queries will go directly to the search results page.Add a tilde~ before the query.Example "~Frida Kahlo".The search suggestions will still appear, but hitting the Enter key at any time will take you to the search results page.
Accent/diacritic folding is turned on for some languages; the details are language-specific.
The algorithm used to rank suggestions is described in more detail atExtension:CirrusSearch/CompletionSuggester.
A "full text search" is an "indexed search".All pages are stored in the wiki database, and all the words in the non-redirect pages are stored in the search database, which is an index to practically the full text of the wiki.Each visible word is indexed to the list of pages where it is found, so a search for a word is as fast as looking up a single-record.[1]Furthermore, for any changes in wording, the search index is updated within seconds.
There are many indexes of the "full text" of the wiki to facilitate the many types of searches needed.The full wikitext is indexed many times into many special-purpose indexes, each parsing the wikitext in whatever way optimizes their use.Example indexes include:
There is support for dozens of languages, but all languages are wanted.There is a list of currently supported languages atelasticsearch.org; see theirdocumentation on contributing to submit requests or patches.Third-party open-source libraries are also used to support additional languages not covered by Elasticsearch.
CirrusSearch will optimize your query, and run it. The resulting titles are weighted by relevance, and heavily post-processed, 20 at a time, for the search results page. For example snippets are garnered from the article, and search terms are highlighted in bold text.
Search results will often be accompanied by various preliminary reports. These includeDid you mean (spelling correction), and, when no results would otherwise be found it will sayShowing results for (query correction) andsearch instead for (your query).
Search features also include:
~ to disable navigation and suggestions in such a way that also preserves page ranking.The basic search term is a word or a "phrase in quotes".Details vary by language, especially for languages without spaces, but search typically recognizes a "word" to be:
A "stop word" is a word that is ignored (because it is common, or for other reasons).The list of stop words is language-specific and not all languages support stop words.[2] A given search term matches againstcontent (rendered on the page). To match against wikitext instead, use theinsource search parameter (Seesection below). Each search parameter has its own index, and interprets its given term in its own way.[3]
Spacing between words, phrases, parameters, and input to parameters, can include generous instances of whitespace andgreyspace characters."Greyspace characters" are all the non-alphanumeric characters~!@#$%^&()_+-={}|[]\:";'<>?,./.A mixed string ofgreyspace characters and whitespace characters, is "greyspace", and is treated as one big word boundary.Greyspace is how indexes are made and queries are interpreted.[4]
Two exceptions are where 1) anembedded:colon is one word (it being treated as a letter), and 2) an embedded comma, such as in1,2,3, is treated as a number.Greyspace characters are otherwise ignored unless, due to query syntax, they can be interpreted as modifier characters.
The modifiers are~ * \? - " !. Depending on their placement in the syntax they can apply to a term, a parameter, or to an entire query. Word and phrase modifiers are the wildcard, proximity, and fuzzy searches. Each parameter can have their own modifiers, but in general:
~ character (and a number telling the degree).~ character prefixed to the first term of a query guarantees search results instead of any possible navigation.A phrase search can be initiated by various hints to the search engine. Each method of hinting has a side-effect of how tolerant the matching of the word sequence will be. Forgreyspace,camelCase, ortxt2number hints:
txt 2 number ortxt-2.number.invisible hand within the textmeetings invisible hand shake.A "search instead" report is triggered when a universally unknown word is ignored in a phrase.
Each one of the following types of phrase-matching contains and widens the match-tolerances of the previous one:
"exact]phrase".camelcase, in all lowercase, because CirrusSearch is not case sensitive in matching. Note thatCamelCase matching is not enabled for all languages.Some parameters interpret greyspace phrases, but other parameters, likeinsource only interpret the usual "phrase in quotes".
| Search phrase | parserfunction | parserFunction | parser function | parser-function | parser:function | parSer:funcTion |
|---|---|---|---|---|---|---|
| parserfunction | ||||||
| "parser function" | ||||||
| parser_function | ||||||
| parserFunction | ||||||
| "parser:function" | ||||||
| "parser_function" | ||||||
| "parSer_funcTion" | ||||||
| parSer_FuncTion |
Note that all stemming is case insensitive.
Note how the "exact phrase" search interpreted theembedded:colon character as a letter, but not theembedded_underscore character. A similar event occurs with the comma, character inside a number.
Givenin:this:word, CirrusSearch, when in an "exact phrase" context, (which includes theinsource parameter context), will not matchin,this, orword, but will then only matchin:this:word.
Otherwise, remember that for CirrusSearchwords are letters, numbers, or a combination of the two, and case does not matter.
The common word search employs the space character and is aggressive with stemming, and when the same words are joined by greyspace characters or camelCase they are aggressive with phrases and subwords.
When common words like "of" or "the" are included in a greyspace-phrase, they are ignored, so as to match more aggressively.
A greyspace_phrase search term, or a camelCase, or a txt2number term, match the signified words interchangeably. You can use any of those three forms.[5]Nowcamelcase matchescamelCase because Search is not case sensitive, butcamelCase matchescamelcase because camelCase is more aggressive.Like the rest of Search, subword "words" are not case-sensitive. By comparison the "exact phrase" is greyspace oriented and ignores numeric or letter-case transitions, and stemming. "Quoted phrases" are not case sensitive.
From the table we can surmise that the basic searchparser_function -"parser function" is the sum of the basic searchesparserFunction andparser<stems> function<stems>.
Making inquiries with numbers, we would find that:
plan9,plans 9,planned 9th,(planned) 9.2,"plans" (9:24)plan9 (case insensitive)plan9 orplanet4589.The star* wildcard matches a string of letters and digits within a rendered word,but never the beginning character.One or more characters must precede the* character.
The\? wildcard represents one letter or number;*\? is also accepted, but\?* is not recognized.
The wildcards are for basic word, phrase, and insource searches, and may also be an alternative to (some) advanced regex searches (covered later).
Putting a tilde~ character after a word or phrase activates a fuzzy search.
exact phrase.| flowers algernon | Flowers for Algernon | flowers are for Algernon | Flowers a1 2b 3c 4f 5j 6l 7j 8p q9 z10 for Algernon | |
| "flowers algernon" | ||||
| "flowers algernon"~0 | ||||
| "flowers algernon"~1 | ||||
| "flowers algernon"~2 | ||||
| "flowers algernon"~11 | ||||
| "algernon flowers"~1 | ||||
| "algernon flowers"~2 | ||||
| "algernon flowers"~3 | ||||
| "algernon flowers"~4 | ||||
| "algernon flowers"~13 |
For the closeness value necessary to match in reverse (right to left) order, count and discard all the extra words, then add twice the total count of remaining words minus one.(In other words, add twice the number of segments).For the full proximity algorithm, seeElasticsearch slop.
Quotes turn off stemming,"but appending"~ the tilde reactivates the stemming.
| flowers | flower | Flowers for Algernon | flower for Algernon | ||
| flowers | Stemming is in effect. | ||||
| "flowers" | Proximity search turns off stemming. | ||||
| "flowers"~ | Proximity plus stemming by suffixing a tilde. | ||||
| "flowers for algernon" | Proximity search turns off stemming. | ||||
| "flowers for algernon"~ | Proximity plus stemming by suffixing a tilde. | ||||
| "flowers algernon"~1 | Proximity search turns off stemming. | ||||
| "flowers algernon"~1~ | Proximity plus stemming by suffixing a tilde. |
≥ 1.24 Gerrit change 137733 |
Insource searches can be used to find any oneword rendered on a page, but it's made for finding any phrase you might find - includingMediaWiki markup (aka wikicode), on any page except redirects. This phrase completely ignores greyspace:insource: "state state autocollapse" matches|state={{{state|autocollapse}}}.
| insource: word insource: "word1 word2" | Greyspace characters are ignored, just as they are with word searches and exact-phrase searches. |
| insource:/regexp/ insource:/regexp/i | These areregular expressions. They aren't efficient, so only a few are allowed at a time on the search cluster, but they are very powerful. The regular expression matches case-sensitively by default; case-insensitivity can be opted in with the extrai, which is even less efficient. |
Insource complements itself. On the one hand it has full text search for any word in the wikitext, instantly. On the other hand it can process a regexp search for any string of characters.[6]Regexes scan all the textual characters in a given list of pages; they don't have a word index to speed things up, and the process is interrupted if it runs for more than twenty seconds.Regexes run last in a query, so to limit needless character-level scanning, every regex query should include other search terms to limit the number of documents that need to be scanned.[7]Often the best candidate to add to the regex queryinsource:/arg/ isinsource:arg, wherearg is the same (and uses no wildcards).
The syntax for the regexp isinsource: no space, and then/regexp/. (No other parameter disallows a space. All the parameters exceptinsource:/regexp/ accept space after their colon.)
Insource indexed-search and regexp-search roles are similar in many respects:
But indexed searches all ignore greyspace; wildcards searches do not match greyspace, so regexes are the only way to find an exact string ofany and all characters, for example a sequence of two spaces.Regexes are an entirely different class of search tool that make matching a literal string easy (basic, beginner use), and make matching by metacharacter expressions possible (advanced use) on the wiki.See#Regular expression searches below.
"in-law" insource:/-in-law/i or"kung" insource:/!kung/i.Prepending a namespace term likefile: to a search query limits results to a specificnamespace, instead of searching the entire wiki.The default namespace is "Main".
Only one namespace name can be set from the search box query.It must be thefirst term in the query, or, if used as part of aprefix: term, must appear as thelast term in the query.
Two or more namespaces may be searched from theAdvanced pane of thesearch bar found on the top of every search results page,Special:Search.Your search domain, as a profile of namespaces, can be set here.The namespaces list will then present itself on the first page of future search results to indicate the search domain of the search results.To unset this, select the default namespace (shown in parentheses), select "Remember", and press Search.
Thesearch bar graphically sets and indicates a search domain. "Content pages" (mainspace), "Multimedia" (File), "Everything" (all plus File), "Translations", etc., are hyperlinks that can activate the query in that domain, and then indicate this by going inactive (dark). But the query will override the search bar.When a namespace or prefix is used in the query the search bar activations and indications may be misleading, so the search bar and the search box are mutually exclusive (not complementary) ways to set the search domain.
A namespace term overrides the search bar, and aprefix: term overrides a namespace.
To specify a namespace name, prefix it with a colon,e.g.,talk:.Useall: to search acrossall namespaces, or: (a single colon) to search just the main article namespace.
Theall: term does not include the File: namespace, which includes media content held at Commons such as PDF, which are all indexed and searchable.When File is involved, a namespace modifierlocal: has an effect, otherwise it is ignored.
As with search parameters,local: andall: must be lowercase.Namespaces names, though, are case insensitive.
Namespace aliases are accepted.
| talk: "Wind clock" | Find pages in theTalk namespace whose title or text contains the phrase "wind clock". |
| file: "Wind clock" | Find pages inFile namespace, whose title, text, or media content contains the phrase "wind clock". |
| file: local: "Wind clock" | Filter out results from Commons wiki. |
| local: "Wind clock" | Ignored. Searches mainspace. Local is ignored unless File is involved. |
prefix:Theprefix: parameter matches any number of first-characters of all pagenames in one namespace.[8]When the first letters match a namespace name and colon, the search domain changes.
Given a namespace only,prefix: will match all its pagenames. Given one character only, it cannot be- (dash),' (quote), or" (double quote). The last character cannot be a colon.
For pagenames that match, their subpage titles match by definition.
Theprefix: parameter does not allow a space before a namespace, but allows whitespace before a pagename.This termalways goes at the end, so that pagename characters may contain quotation marks (").
| prefix:cow | Find pages in mainspace whose title starts with the three lettersc o w. |
| domestic prefix:cow | Find pages in mainspace whose title starts with the three lettersc o w, and that contain the word "domestic". |
| domestic prefix:cow/ | List any existing subpages ofCow but only if they contain the word "domestic". This is a very common search and is frequently built using a special URL parameter calledprefix=. |
| domestic prefix:Talk:cow/ | List any subpages ofTalk:cow, but only if they contain the word "domestic". |
| 1967 prefix:Pink Floyd/ | List any subpages ofPink Floyd, but only if it also contains the word "1967". |
TheTranslate extension creates a sort of "language namespace" of translated versions of a page.However, unlike namespace or prefix, which create the initial search domain, theinlanguage parameter is afilter of it. (See the next section.)
Content can be excluded from the search index by addingclass="navigation-not-searchable". This will instruct CirrusSearch to ignore this content from the search index (seeT162905 for more context).
Additionally content can be marked as auxiliary information by addingclass="searchaux".This will instruct CirrusSearch to move the content from the main text to an auxiliary field which has lower importance for search and snippet highlighting.This distinction is used for items such as image thumbnail descriptions, 'see also' sections, etc.
A filter will have multiple instances, or negated instances, or it can run as a standalone filtering a search domain.A query is formed as terms that filter a search domain.
Adding another word, phrase, or parameter filters more. A highly refined search result may have very many Y/N filters when every page in the results will be addressed. (In this case ranking is largely irrelevant.)Filtering applies critically to adding a regex term; you want as few pages as possible before adding a regex (because it can never have a prepared index for its search).
A namespace is a specified search domain but not a filter because a namespace will not run standalone.Aprefix will negate so it is a filter.The search parameters below are filters for which there may be multiple instances.
Insource (covered above) is also a filter, butinsource:/regexp/ is not a filter. Filters and all other search parameters are lowercase. (Namespaces are an exception, being case insensitive.)
Word and phrase searches match in a title and match in the category box on bottom of the page. But with these parameters you can select titlesonly or categoryonly.
Intitle andincategory are old search parameters. Incategory no longer searches any subcategory automatically, but you can now add multiple category pagenames manually.
≥ 1.31 Gerrit change 413896 |
SinceMediaWiki 1.31-wmf.23 Regular expression searches are supported for intitle:
Everything written in the#Regular expression searches is also valid for these searches, including warnings.
Deep category search allows to search in category and all subcategories. The depth of the tree is limited by 5 levels currently (configurable) and the number of categories is limited by 256 (configurable). The deep search usesSPARQL Category service from WDQS. Keywords aredeepcategory ordeepcat. Example:
The DeepCat gadget that previously implemented the parameter was sunsetted in January 2020.
Linksto finds wikilinks to a givenname, not links tocontent. The input is the canonical, case sensitive, pagename.It must match the title line of the content page, exactly, before any title modifications of the letter-case.(It must match its {{FULLPAGENAME}}, e.g. Help:CirrusSearch.)
Linksto does not find redirects. It only finds [[wikilinks]], even when they are made by a template.It does not find a link made by a URL, even if that URL is an internal wiki link.
To find all wikilinks to a "Help:Cirrus Search", if "Help:Searching" and "H:S" are redirects to it:
CirrusSearch -linksto: Help:CirrusSearch finds articles that mention "CirrusSearch" but not in a wikilink.
You can specify template usage withhastemplate:template. Input the canonical pagename to findall usage of the template, but use any of its redirect pagenames findsjust that naming. Namespace aliases are accepted, capitalization is entirely ignored, and redirects are found, all in one name-search. (Compareboost-template no default namespace;linksto no namespace aliases, case-sensitive, no redirects;intitle no redirects.)
Hastemplate finds secondary (or meta-template) usage on a page: it searches the post-expansion inclusion. This is the same philosophy as forwords and phrases from a template, but here it's fortemplates from a template. The page will be listed as having that content even though that content is not seen in the wikitext.
For installations with the Translate extension,hastemplate searches get interference whereverTemplate:Translatable template name wraps the template name of a translatable template. Useinsource instead.
For installations with the Translate extension,inlanguage is important for highly refined searches and page counts.
will produce search results in that language only.
For example
Thecontentmodel: keyword allows to limit the search to pages of a specific content model. For possible models cf.Content handlers. E.g.:
contentmodel:jsonTo find sub-pages.
For example
Thearticletopic: keyword allows filtering search results by topic. For possible topics seeHelp:CirrusSearch/articletopic.E.g.articletopic:books will filter the search results to articles about books.articletopic:books|films will filter to articles about books or films.articletopic:books articletopic:films will filter to articles which are about both books and films.
Only mainspace articles belong into topics, and topics are only available on Wikipedias.Unlike other filters, articletopic also does page weighting: articles which are a stronger match for a topic will be higher in the search results (while articles which aren't about that subject at all will be removed from the result set completely).
Topic models are derived viaMachine Learning.Any given article receives a score on dozens of different topics, and therefore may appear under different keywords.For instance, the article on Albert Einstein may appear as a "physics" article and a "biography" article.All Wikipedias have scores available -- some have local-language topic models that have coverage on all articles.Other languages do not have local models, and are using English-language scores assigned to articles in the local language that also exist in English Wikipedia.The languages with such "cross-wiki" scores do not have 100% coverage -- depending on the language, it may only be something like 60% of articles that have topics available.
≥ 1.45 Gerrit change 1191677 |
This keyword allows to set aboost factor to influence the importance of the various topics you want to search for:
articletopic:books^2.0|fashion^0.2 - to list articles about books or fashion but will give more importance to the ones about books.articletopic:books^100 - to give a strong importance to this keyword in comparison to other ranking criteria (other keywords or words, number of incoming links or the popularity of the page...)Thisboost factor must be a positive number.
This keyword allows to filter and rank pages based on prediction made by theArticle country model.
The values it supports are documented atHelp:CirrusSearch/articlecountry:
articlecountry:and - filter pages that may be related to Andorraarticlecountry:bel|fra - filter pages that may be related to Belgium or France.Similar toarticletopic this keyword may accept aboost factor.
Thepageid: keyword restricts search results to the given set of page IDs.This is not really useful for manual searching; it can be used by software tools for checking whether a set of pages match the given set of search conditions (e.g. for re-validating cached search results).
You can filter search results by date using two filters:
lasteditdate: - for when pages were last editedcreationdate: - for when pages were first created (the date of their first revision).This allows you to find recently updated content, pages that have not been updated in some time, or pages created within specific time periods.All date queries use the local timezone of the wiki you are searching, your personal timezone settings do not effect the results.
You can add comparison operators before any date to constrain your search:
| Operator | Meaning | Example | Description |
|---|---|---|---|
> | after | creationdate:>2024 | Pages created after 2024 |
>= | on or after | lasteditdate:>=2024 | Pages last edited in 2024 or later |
< | before | creationdate:<2025 | Pages created before 2025 |
<= | on or before | lasteditdate:<=2020 | Pages last edited in 2020 or earlier |
Without an operator, the search looks for exact matches within that time period.
The precision of your search depends on how the date is provided.When providing an absolute date it depends on how specific your date is:
| Precision | Example | Description |
|---|---|---|
| year | creationdate:2025 | Pages created anywhere in 2025 |
| month | lasteditdate:2025-09 | Pages last edited in September 2025 |
| day | creationdate:2025-09-01 | Pages created on September 1, 2025 |
Alternatively you can provide a relative date using eithernow ortoday.The precision of the search will be determined by the keyword used.The keyword can be suffixed by a minus sign (-) followed by a number and a suffix.The following suffixes are available for use:
| Keyword | Precision | Example | Description |
|---|---|---|---|
now | hour | lasteditdate:now | Pages last edited in the current hour |
now | hour | creationdate:now-1h | Pages created in the previous hour |
now | hour | lasteditdate:>=now-1d | Pages last edited in the 24 previous hours |
today | day | creationdate:today | Pages created today |
today | day | lasteditdate:today-1d | Pages last edited yesterday |
today | day | creationdate:>today-1y | Pages created anytime in the last year |
While there's no single "range" operator, you can create date ranges by combining two date filters in the same query.
| Example | Description |
|---|---|
creationdate:>=2010 creationdate:<2020 | Pages created in the 10's (from January 1, 2010 to January 1, 2020). |
This keyword can be used to filter pages for which a machine learning model has made recommendation for (generally detecting improvements to make).
hasrecommendation:image - filter pages for which a model recommended to add an image.The types of recommendations depend on the model and wikis for which this system has been enabled.
For instance on WMF wikis there are models that may flag:
This keyword is generally used by other tools such asGrowth/Personalized first day/Structured tasks.
If the recommendation is stored with itsconfidence score the keyword can be used to filter using athreshold and/orboost using a factor.For instance if you want to filter pages where a recommendation of typetone has a confidence score above 0.5 you can use:hasrecommendation:tone>0.5.Similarly if you want the hasrecommendation to influence the ranking of the search results you can use aboost factor:hasrecommendation:tone^1.0.You can also combine these two with:hasrecommendation:tone^1.0>0.5.
Weighting determines snippet, suggestions, and page relevance. The normal weight is one. Additional weighting is given through multipliers.
If the query is just words, pages that match them in order are given a boost. If you add anyexplicit phrases to your search, or for certain other additions, this "prefer phrase" feature is not applied.
morelike:wasp|bee|antmorelike:template:search|template:regex|template:usagemorelike is a "greedy" keyword, meaning that it cannot be combined with other search queries. If you want to use other search queries, usemorelikethis in your search:
morelikethis:bee hastemplate:"featured article"Themorelike: query works by choosing a set of words in the input articles and run a query with the chosen words. You can tune the way it works by adding the following parameters to the search results URL:
true |false) - use only the field data. Defaults tofalse: the system will extract the content of thetext field to build the query.&cirrusMtlUseFields=yes&cirrusMltFields=title&cirrusMltMinTermFreq=1&cirrusMltMinDocFreq=1&cirrusMltMinWordLength=2
These settings can be made persistent by overridingcirrussearch-morelikethis-settings inSystem message.
Addingprefer-recent: anywhere in the query gives recently edited articles a slightly larger than normal boost in the page-ranking rules.Prefer-recent is only applied when using the defaultrelevancesort order.
It defaults to boost only 60% of the score, in a large, 160-day window of time, which can be entered in the query asprefer-recent:0.6,160. This plays well with other page ranking rules, and is intended for most searches.
You can manipulate the rules:prefer-recent:boost,recentTechnically, "boost" is the proportion of score to scale, and "recent" is the half life in days.The boost is more than the usualmultiplier, it is anexponential boost.The factor used in the exponent is the time since the last edit.
For example
Pages older than 7 days are boosted half as much, and pages older than 14 days are boosted half as much again, and so on.For a simple "sort by date" in highly refined search results, where page ranking and boosting are largely meaningless, just boost the entire score.
You can boost pages' scores based on what templates they contain. This can be applied to all search queries by declaring boosts viaMediaWiki:Cirrussearch-boost-templates, or ad-hoc in individual queries via theboost-templates:"" operator. If theboost-templates operator is set in a query, then the contents ofcirrussearch-boost-templates are ignored.Similar to the prefer-recent feature, boost-templates is applied as part of the defaultrelevancesort order. It has no effect on other search orders.
The syntax of the message is as follows:
# character to the end of the line is considered a comment, and ignored.Good examples:
Template:Important|150% Template:Very_Very_Important|300% Template:Less_important|50%
Bad examples:
Template:Foo|150.234234% # decimal points are not allowed. Foo|150% # technically valid, but acts on transclusions of Foo (main space article) instead of Template:Foo.
Some examples:
cirrussearch-boost-templates message this can be reduced to justpopcorn.Decimal points are not permitted in percentage values. Search scoring is such that fractions of a percent are unlikely to make a difference.
Beware that if you add very low or very high percentages viacirrussearch-boost-templates, they can poison the full-text scoring.For example, if Wikipedia were to boost the "Featured article" template by 1 million percent, then, searches for any term mentioned in featured articles, would rank the featured article above even the dedicated article about that term.
Phrase matching would be similarly blown away, so a search likebrave new world would return a featured article as first result even if it merely has those three words mentioned throughout it, instead of the more relevant article aboutBrave New World itself.
| Do not run a bareinsource:/regexp/ search. It will probably timeout after 20 seconds anyway, while blocking the queries of responsible users. |
A basic indexed search findswords rendered visible on a page. Hyphenation and punctuation marks and bracketing, slash and other math and computing symbols, are merely boundaries for thewords. It is not possible to include them in an indexed search.Mostly that search behavior is wanted by the user. However, sometimes one wants to have the ability for a more precise search.
To get around the syntactic deficiency of index-based searches regexp searches can be used.But as queries with only regexp expressions are very slow and resource consuming, they should always be combined with an index-based search, such that the regexp search-domain gets limited to the results of one or more index-based search.
An "exact string" regexp search is a basic search; it will simply "quote" the entire regexp, or "backslash-escape" all non-alphanumeric characters in the string. All regexp searches also require that the user develops a simple filter to generate the search domain for the regex engine to search (index based search domain marked bold, regexp part marked in italics):
The last example works from a link on a page, but {{FULLPAGENAME}} doesn't function in the search box.
For example:[[Special:Search/insource:/regex/ prefix:{{FULLPAGENAME}}]] finds the termregex on this page.
A query with no namespace specified and no prefix specified searches your default search domain, (settable on any search-results page, i.e. atSpecial:Search). Some users keep their default search domain at "all namespaces", i.e. the entire wiki. On a large wiki if this user does a bare regexp search it will probably fail, incurring a timeout, before completing the search.
A regex search actually scours each page in the search domain character-by character.By contrast, an indexed search actually queries a few records from a database separately maintained from the wiki database, and provides nearly instant results.So when using aninsource:// (a regexp of any kind), consider adding other search terms that will limit the regex search domain as much as possible.There are many search terms that use an index and so instantly provide a more refined search domain for the /regexp/. In order of general effectiveness:
To test a bare regexp query you can create a page with test patterns, and then use theprefix parameter with that fullpagename.The match will be highlighted.It searches that page (in the database) and its subpages.
Search terms that do not increase the efficiency of a regexp search are the page-scoring operators:morelike,boost-template, andprefer-recent.
This section covers how to escape metacharacters used in regexp searches.For the actual meaning of the metacharacters see theexplanation of the syntax.[9]
For example:
There are some notable differences from standard regex metacharacters:
. metacharacter stands for any character including a newline, so.* matches across lines.# sign means something, and must be escaped.[10]^ and$ are only available forintitle:// searches, but not forinsource://. When matching titles^ and$ match the beginning and end of the title. Like "grep" (global per line, regular expression, print each line), eachinsource:// is a "global per document, regular expression, search-results-list each document" per document.< and> support a multi-digit numeric range like[0-9] does, but without regard to the number of character positions, or the range in each position, so<9-10> works, and even<1-111> works.Regex search supports a minimal set of character classes.While negated short hands such as\W are not available the classes can be negated as part of a character class, as in[^\w].
| CirrusSearch | Description |
|---|---|
| \w | Matches any alphanumeric ascii character and the underscore. Equivalent to [A-Za-z0-9_] |
| \s | Matches the space character and a variety of unicode spaces. Equivalent to [\f\n\r\t\v\u0020\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff] |
| \d | Matches any digit. Equivalent to [0-9] |
Regex search also supports a few escape codes which make it possible to search for unprintable characters.
| CirrusSearch | Description |
|---|---|
\r | carriage return (CR) |
\n | line feed (LF) |
\t | tab |
\uHHHH | Can represent any unicode character. It must be provided exactly 4 hexadecimal characters representing the codepoint.Surrogate pairs are represented with two sequences in a row. Searching for half a surrogate pair will not return any results. |
You can start out intending an exact string search, but keep in mind:
There are two ways to escape metacharacters. They are both useful at times, and sometimes concatenated side-by-side in the escaping of a string.
Double-quotes escaping using insource:/"regexp"/ is an easy way to search for many kinds of strings, but you can't backslash-escape anything inside a double-quoted escape.
/"[[page/name|{{temp-late"/ instead of/\[\[page\/name\|\{\{temp\-late//"literal back\slash"/ is as good as/literal back\\slash//"This \" fails"/ always./"This \/ depends"/. It finds the\/ literally, which is not the/ you probably wanted.Backslash-escape using insource:/regexp/ allows escaping the " and / delimiters, but requires taking into account metacharacters, and escaping any:
/ delimiter character use\/." delimiter character use\".\~\@\#\&\*\(\)\-\+\{\}\[\]\|\<\>\?\.\\."~@#&*()-+{}[]|\<>?.\".The simplest algorithm to create the basic string-finding expression using insource:/"regexp"/, need not take metacharacters into account except for the " and / characters:
the/str"ing out. (The /" delimiters "/ are not shown.)" with"\"" (previous double-quote: stop, concatenate, quote restart)./ with"\/" (stop, concatenate, start).insource:/"the"\/"str"\""ing"/, showing concatenation of the two methods.The square-bracket notation for creating your own character-classalso escapesits metacharacters. To target a literal right square bracket in your character-class pattern, it must be backslash escaped, otherwise it can be interpreted as the closing delimiter of the character-class pattern definition.The first position of a character class will also escape the right square bracket. Inside the delimiting square brackets of a characterclass, the dash character also has special meaning (range) but it too can be included literally in the class the same way as the right square bracket can.For example both of these patterns target a character that is either a dash or a right square bracket or a dot:[-.\]] or[].\-].
For general examples using metacharacters:
Theinsource keyword does only search the page source content.To run regex searches on the title stringsintitle:/regex/ can be used.
For example, using metacharacters to find the usage of a template calledVal having, inside the template call, an unnamed parameter containing a possibly signed, three to four digit number, possibly surrounded by space characters,and on the same page, inside a template Val call, a named argumentfmt=commas having any allowable spaces around it, (it could be the same template call, or a separate one):
hastemplate:val insource:"fmt commas" insource:/\{\{ *[Vv]al *\|[^}]*fmt *= *commas/ insource:/\{\{ *[Vv]al *\|[^}]*[-+]?[0-9]{3,4} *[|}]/Note that the = sign in "fmt commas" is not needed but that adding it would not change the search results.It is fast because it uses two filters so that every page the regexp crawls has the highest possible potential.
Searching based on the (primary) coordinates associated with pages.Depends onExtension:GeoData and{{#coordinates:}}
You can limit search to pages identified as being near some specified geographic coordinates.The coordinates can either be specified as a <lat>,<lon> pair, or by providing a page title from which to source the coordinates.A distance to limit the search to can be prepended if desired.Examples:
You can alternatively increase the score of pages within a specified geographic area.The syntax is the same as bounded search, but with boost- prepended to the keyword.This effectively doubles the score for pages within the search range, giving a better chance for nearby search results to be near the top.
≥ 1.28 Gerrit change 311061 |
Since MediaWiki 1.28, CirrusSearch supports indexing and searching of properties of files in theFile: namespace. This includes:
File: namespace. It is recommended to include this namespace in a search or restrict the search to only this namespace when using these conditionals.Searching for file type allows to retrieve files according to their classification, such as office documents, videos, raster images, vector images, etc. The following types currently exist:
UNKNOWNBITMAPDRAWINGAUDIOVIDEOMULTIMEDIAOFFICETEXTEXECUTABLEARCHIVE3DThis list may be extended in the future. See alsoMEDIATYPE_* constants indefines.php.
The syntax of the search is:filetype:{type}. Example:
filetype:video - looks for all videos
The filetype search is not case-sensitive.
Matches file MIME type. The syntax is:
filemime:{MIMEtype} - look for files of this MIME type
The argument can be quoted to specify exact match. Without quotes, partial matches to components of MIME type will be accepted too.
Examples:
image/pngThe MIME type search is not case-sensitive.
Search for file of given size, in kilobytes (kilobyte means 1024 bytes). The syntax is:
Examples:
It is possible to search for specific file measures: width, height, resolution (which is defined as square root of height × width), and bit depth. Not all files may have these properties. The syntax is:
Wheremeasure can be:
Examples:
TheWikibase extension defines some search keywords in order to make it easier to search for certain Wikibase items. This is useful onWikidata and other Wikibase sites, including to search for images withStructured data onWikimedia Commons.SeeHelp:WikibaseCirrusSearch for details.
There are two kinds of cross-wiki results that may be shown when searching on Wikipedia.
Cross-project search (also known as interwiki search, sister search, or sister projects search) shows additional results from other projects (Wiktionary, Wikisource, Wikiquote, etc.) shown to the side on the Wikipedia results page.Cross-project search is available on most Wikipedias with sister projects.
Cross-language search (seeblog post) refers to additional results shown below the main results that are from a Wikipedia in a different language.Cross-language search uses a heavily modified and optimized version of a light-weight language detector calledTextCat.Cross-language search is currently only available on a few Wikipedias (see TextCat link for details).
In addition to the default relevance based sort, CirrusSearch can provide results using a few other explicit sort orders.Specifying a sorting order other thanrelevance will disable all search keywords that affect scoring, such asprefer-recent orboost-templates.The keywords will still be parsed, but they will have no effect.
Sorting options are currently available from the MediaWiki API by providing thesrsort parameter.
Guidance:
Sorting options can be manually added to a search URL by adding&sort=order, for example:
Valid sort orders include:
&sort=incoming_links_asc&sort=incoming_links_desc&sort=last_edit_asc&sort=last_edit_desc&sort=create_timestamp_asc&sort=create_timestamp_desc&sort=just_match&sort=relevance&sort=random&sort=user_random&sort=noneSome search options when used together may interfere with or modify their operation when used alone.

TheAdvancedSearch extension adds an improved interface to the search page allowing the use of several options described above in a user-friendly manner. Seehere for the user manual.