(Redirected from Search/CirrusSearchFeatures)
Jump to: navigation, search

Other languages:
العربية • ‎বাংলা • ‎català • ‎čeština • ‎Deutsch • ‎Zazaki • ‎Ελληνικά • ‎English • ‎Esperanto • ‎español • ‎فارسی • ‎suomi • ‎français • ‎עברית • ‎Bahasa Indonesia • ‎italiano • ‎日本語 • ‎한국어 • ‎Lëtzebuergesch • ‎македонски • ‎Nederlands • ‎occitan • ‎polski • ‎پښتو • ‎português • ‎português do Brasil • ‎русский • ‎Basa Sunda • ‎svenska • ‎தமிழ் • ‎Türkçe • ‎ئۇيغۇرچە • ‎українська • ‎ייִדיש • ‎中文

CirrusSearch is a newly available search engine from MediaWiki, as of June 2013. The Wikimedia Foundation migrated to CirrusSearch from MWSearch in 2014, because CirrusSearch features key improvements.

This page describes the features that are new or different compared to Help:Searching (MWSearch, still used in the field).

Frequently asked questions

If your question is not answered here, feel free to ask on the talk page and someone will answer it for you.

What's improved?

The new search engine features four main improvements over the old search engine, namely:

  • Faster updates to the search indexes: changes to articles are reflected in search results much more quickly.
  • Search index for templates: Template wordings and subtemplate naming are attributed at each page.
  • Better support for searching in different languages.
  • Regular expression searches.


Updates to the search index will (usually) occur in near real time. So you can successfully Search the change as soon as you save the page. (A null edit will force an update.)

A template change will update in a few minutes all the pages where its transclusion has changed. (The templates changes use the job queue, so performance may vary.)

Search suggestions

Search suggestions are the page names that drop down from the search box while you are typing. They are sorted by the number of incoming links.

Starting with the tilde character ~ disables search suggestions, and you will always end up on the search results page.

Search suggestions will automatically include the accented characters or the characters with diacritical markings. These are folded into there ASCII look-alikes automatically, and are turned on for English text.[1]

Full text search

A "full text search" is an "indexed search". All pages are stored in the wiki database, and all the words in them are stored in the search database, which is an index to the full text of the wiki. Every word is indexed to the list of pages where it is found. A search can be as fast as pulling a single-record. Furthermore, the index is updated within seconds of the change.

There are actually many indexes on the "full text" of the wiki to facilitate all the searches needed. The end-user query is optimized to run the internal series of searches on them and the post-processing of those. Various search parameters advantage particular indexes, and CirrusSearch syntax advantage post processing. The resulting titles are weighted by relevance, and then processed 20 at a time: snippets are garnered, and the search results page formatted into HTML with search terms highlighted in bold text.

Templates are now indexed. If the transcluded words of a template change, then all the pages that transclude it are updated. Not just visible words, but also subtemplates are indexed per page using them. Documents stored in the Media namespace are now indexed. Thousands of formats are allowed.


In search terminology, support for "stemming" means that a search for "swim" will also include "swimming" and "swimmed", but not "swam".

There is support for dozens of languages, but all languages are wanted.

There is a list of currently supported languages at [<tvar|url></>]; see their [<tvar|doc></> documentation on contributing] to submit requests or patches.

Filters (intitle:, incategory: and linksto:)

New search- 6 months later.pdf

We've tightened up the syntax around these quite a bit.

  • intitle:foo
    • Find articles whose title contains foo. Stemming is enabled for foo.
  • intitle:"fine line"
    • Find articles whose title contains fine then line. Stemming is enabled. Matches The finest (lines) but not The finest ever lines.
  • intitle:foo bar
    • Find articles whose title contains foo and whose title or text contains bar.
  • -intitle:foo bar
    • Find articles whose title does not contain foo and whose title or text contains bar.
  • intitle: foo bar
    • Syntax error, devolves into searching for articles whose title or text contains intitle:, foo, and bar.
  • incategory:Music
    • Find articles that are in Category:Music
  • incategory:"music history"
    • Find articles that are in Category:Music_history
  • incategory:"musicals" incategory:"1920"
    • Find articles that are in both Category:Musicals and Category:1920
  • incategory:Felis_silvestris_catus|Dogs
    • Find articles that are either in category:Felis_silvestris_catus or in Category:Dogs
  • -incategory:"musicals" incategory:"1920"
    • Find articles that are not in Category:Musicals but are in Category:1920
  • cow*
    • Find articles whose title or text contains words that start with cow
  • linksto:Help:CirrusSearch
    • find articles that link to a page
  • -linksto:Help:CirrusSearch CirrusSearch
    • find articles that mention CirrusSearch but do not link to the page Help:CirrusSearch


The prefix: syntax in its current form is relied upon for a great deal of functionality so it's been recreated as exactly as possible.


Find articles in the content namespaces whose title starts with the three letters c o w .

domestic prefix:cow

Find articles in the content namespaces whose title starts with the three letters c o w , and that contain the word "domestic".

domestic prefix:cow/

Find all sub-pages of the article Cow in the content namespaces that contain the word "domestic". This is a very common search and is frequently built using a special URL parameter called prefix=.

domestic prefix:Talk:cow/

Find all sub-pages of the talk page of Cow, Talk:cow (in the talk namespace), that contain the word "domestic".

cow prefix:Pink Floyd/

Find all sub-pages of the article Pink Floyd in the content namespaces that contain the word "cow".

Note that the old rule of having to put prefix: at the end of the query still applies.


  • morelike:page name 1|page name 2|...|page name n
    • Find articles whose text is most similar to the text of the given articles.
  • morelike:wasp|bee|ant

Find articles about stinging insects.

  • morelike:template:search|template:regex|template:usage

Find templates about regex searching for template usage on the wiki.

The morelike: 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:

  • cirrusMltMinDocFreq: Minimum number of documents (per shard) that need a term for it to be considered.
  • cirrusMltMaxDocFreq: Maximum number of documents (per shard) that have a term for it to be considered.
  • cirrusMltMaxQueryTerms: Maximum number of terms to be considered.
  • cirrusMltMinTermFreq: Minimum number of times the term appears in the input to doc to be considered. For small fields (title) this value should be 1.
  • cirrusMltMinWordLength: Minimal length of a term to be considered. Defaults to 0.
  • cirrusMltMaxWordLength: The maximum word length above which words will be ignored. Defaults to unbounded (0).
  • cirrusMltFields (comma separated list of values): These are the fields to use. Allowed fields are title, text, auxiliary_text, opening_text, headings and all.
  • cirrusMltUseFields (true|false): use only the field data. Defaults to false: the system will extract the content of the text field to build the query.
  • cirrusMltPercentTermsToMatch: The percentage of terms to match on. Defaults to 0.3 (30 percent).
  • Example: &cirrusMtlUseFields=yes&cirrusMltFields=title&cirrusMltMinTermFreq=1&cirrusMltMinDocFreq=1&cirrusMltMinWordLength=2

These settings can be made persistent by overriding cirrussearch-morelikethis-settings in Help:System message.


A search-domain filter consisting of one namespace can be specified at the beginning of a search. Two or more namespaces may be set at the search results page, Special:Search, in the Advanced dialog. This can be set for the search, or as the default search domain.

Enter a namespace name, or enter All:, or enter a colon : for mainspace.

Namespace aliases are accepted.

For the File namespace, local: is accepted.

Talk:Foo Find pages in the Talk namespace whose title or text contains the word "foo".
File:foo Find pages in the File namespace on this wiki and commons whose title or text contains the word "foo".
File:local:foo Add the local: to the File namespace search to filter the results from commons.

You cannot use an interwiki prefix as a namespace to search other projects.

Did you mean

"Did you mean" suggestions are designed to notice if you misspell an uncommon phrase that happens to be an article title. If so, they'll let you know. They also seem to suggest more things than they ought to sometimes.

Prefer phrase matches

If you don't have too much special syntax in your query we'll give perfect phrase matches a boost. I'm being intentionally vague because I'm not sure exactly what "too much special syntax" should be. Right now if you add any explicit phrases to your search we'll turn off this feature.

Fuzzy search

Putting a ~ after a search term (but not double quotes) activates fuzzy search. You can also put a number from 0 to 1 to control the "fuzziness" fraction, e.g. nigtmare~.9 or lighnin~.1 or lighnin~0.1. Closer to one is less fuzzy.

Phrase search and proximity

Surrounding some words with quotes declares that you are searching for those words close together. You can add a ~ and then a number after the second quote to control just how close you mean. The default "closeness" is zero. One means one extra word allowed, and so on. For more than two words in the phrase, the closeness equals the total number of extra words, provided that all the words are also in order left to right.

flowers algernon Flowers for Algernon flowers are for Algernon Flowers a1 2b 3c 4f 5j 6l 7j 8p q9 z10 for Algernon
"flowers algernon" YesY N N N
"flowers algernon"~0 YesY N N N
"flowers algernon"~1 YesY YesY N N
"flowers algernon"~2 YesY YesY YesY N
"flowers algernon"~11 YesY YesY YesY YesY
"algernon flowers"~1 N N N N
"algernon flowers"~2 YesY N N N
"algernon flowers"~3 YesY YesY N N
"algernon flowers"~4 YesY YesY YesY N
"algernon flowers"~13 YesY YesY YesY YesY

For the closeness value of words given in right to left order, count and discard all the extra words, then add twice the the total count of remaining words minus one (in other words, add twice the number of segments). For the full proximity algorithm, see Elastic Search.

An explicit AND is required between two phrases because of the "inner" quotation marks.

Quotes and exact matches

Quotes turn on exact term matches. You can add a ~ to the quote to go back to the more aggressive matcher you know and love.

flowers flower Flowers for Algernon flower for Algernon
flowers YesY YesY YesY YesY Stemming is in effect.
"flowers" YesY N YesY N Proximity search turns off stemming.
"flowers"~ YesY YesY YesY YesY Proximity plus stemming by suffixing a tilde.
"flowers for algernon" N N YesY N Proximity search turns off stemming.
flowers for algernon"~ N N YesY YesY Proximity plus stemming by suffixing a tilde.
"flowers algernon"~1 N N YesY N Proximity search turns off stemming.
"flowers algernon"~1~ N N YesY YesY Proximity plus stemming by suffixing a tilde.


You can give recently edited articles a boost in the search results by adding "prefer-recent:" to the beginning of your search. By default this will scale 60% of the score exponentially with the time since the last edit, with a half life of 160 days. This can be modified like this: "prefer-recent:<proportion_of_score_to_scale>,<half_life_in_days>". proportion_of_score_to_scale must be a number between 0 and 1 inclusive. half_life_in_days must be greater than 0 but allows decimal points. This number works pretty well if very small. I've tested it around .0001, which is 8.64 seconds.

This will eventually be on by default for Wikinews, but there is no reason why you can't activate it in any of your searches.


You can find pages that use a certain template by adding the filter hastemplate: to the search. We provide for the usual "syntactic sugar" of template calls. This means the lenient pagename and fullpagename capitalization works, and the main namespace abbreviation, ":" works. For example to find which pages transclude Quality image the full search (in all your preferred namespaces) can be: hastemplate:"quality image", and for that same template name in the main namespace, this works hastemplate:":quality image". You can omit the quotes if the template title does not contain a space. -hastemplate:pagename will filter pages that do not contain that template.

For wikitext that calls a template directly, you can use insource:, but hastemplate: searches the "post-expansion inclusion", so hastemplate: can find a template acting only temporarily as a "secondary template" or "meta-template", which are seen in neither the source nor content, ( but only included as a helper to any other template producing the final content). All content from a template is now reflected in search results is still the relevant philosophy here.


You can boost pages' scores based on what templates they contain. This can be done directly in the search via boost-templates:"" or you can set the default for all searches via the new cirrussearch-boost-templates message. boost-templates:"" replaces the contents of cirrussearch-boost-templates if the former is specified. The syntax is a bit funky but was chosen for simplicity. Some examples:

File:boost-templates:"Template:Quality Image|200%" incategory:china
Find files in the China category sorting quality images first.
File:boost-templates:"Template:Quality Image|200% Template:Low Quality|50%" incategory:china
Find files in the China category sorting quality images first and low quality images last.
File:boost-templates:"Template:Quality Image|200% Template:Low Quality|50%" popcorn
Find files about popcorn sorting quality images first and low quality images last. Remember that through the use of the cirrussearch-boost-templates message this can be reduced to just popcorn.

Don't try to add decimal points to the percentages. They don't work and search scoring is such that they are unlikely to matter much.

A word of warning about cirrussearch-boost-templates: if you add really really big or small percentages they can poison the full text scoring. Think, for example, if enwiki boosted featured articles by a million percent. Then searches for terms mentioned in featured articles would find the featured articles before exact title matches of the terms. Phrase matching would be similarly blown away so a search like brave new world would find a featured article with those words scattered throughout it instead of the article for Brave New World.

Sorry for the inconsistent - in the name. Sorry again but the quotes are required on this one. Sorry also for the funky syntax. Sorry we don't try to emulate the template transclusion syntax like we do with hastemplate:.


Gerrit change 137733

This can pick up template arguments, URLs, links, html, etc. It has two forms, one is an indexed search, and the other is regex based.

insource:"word1 word2"

Like word searches and exact-phrase searches, non-alphanumeric characters are ignored, and proximity and fuzziness are options.


These are Regular expressions. They aren't efficient, so we can only allow a few at a time on the search cluster, but they are very powerful.

The version with the extra i runs the expression case-insensitive, and is even less efficient.

Tip: Instead of running a bare insource:/regexp/, these return much much faster when you limit the regexp search-domain to the results of one or more index-based searches. 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 develop a simple filter to generate the search domain for the regex engine to search:

  • insource:"" insource:/debian\.reproducible\.net/
  • insource:"c:\program files (x86)" insource:/C\:\\Program Files \(x86\)/i
  • insource:"<tag>{{template}}<tag>" insource:/"<tag>{{template}}<\/tag>"/
  • insource:"[[title|link label]]'s" insource:/"[[title|link label]]'s"/
  • insource:/regexp/ prefix:{{FULLPAGENAME}}

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 term regex on this page ]].

Any search with no namespace specified (or prefix specified) searches your default search domain, settable on any search-results page, i.e. settable at Special:Search. The default search domain is commonly reset by power users to All namespaces, i.e. the entire wiki, but if this occurs for a bare regexp search, then on a large wiki it will probably incur an HTML 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 using an insource:// (a regexp of any kind), consider creating one the 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:

  • insource:"" with quotation marks, duplicating the regexp except without the slashes or escape characters, is ideal.
  • intitle, incategory, and linksto are excellent filters.
  • hastemplate: is a very good filter.
  • "word1 word2 word3", with or without the quotation marks, are good.
  • namespace: is practically useless, but may enable a slow regexp search to complete.

The prefix operator is especially useful with a {{FULLPAGENAME}} in a search template, a search link, or an input box, because it automatically searches any subdirectories. To develop a new regexp, or refine a complex regexp, use prefix:{{FULLPAGENAME}} on a page with a sample of the target data.

Search terms that do not increase the efficiency of a regexp search are the page-scoring operators: morelike, boost-template, and prefer-recent.


This section covers how to escape the metacharacters used in rexexp searches. For the actual meaning of the metacharacters see the explanation of the syntax.[2]

You can search for the (seemingly basic) string of characters you once saw, like "wiki-link" or perhaps "(trans[in]clusion)", or a string you want to see, like "2 + 2 = 4", or "". You can do this only with a regex search, but

  • regex only search the wikitext not the rendered text, so there are some differences around the markup, and even the number of space characters must match precisely.
  • You are obligated to supply an accompanying filter.
  • You must learn how to escape regex metacharacters.

There are two ways to escape metacharacters, and they are both useful at times, and sometimes concatenated side-by-side in the escaping of a string.

  • Backslash-escape one of them \char. The insource:/regexp/ uses slashes to delimit the regexp. Giving /reg/exp/ is ambiguous, so you must write /reg\/exp/.
  • Put a string of them in double quotes "string". Because escaping a character can't hurt, you can escape any character along with any possible metacharacters in there.
  • You can't mix methods, but you can concatenate them.

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/
  • But /"This \" fails"/ always.
  • And /"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:

  • To match a / delimiter character use \/.
  • To match a " delimiter character use \".
  • The metacharacters would be \~\@\#\&\*\(\)\-\+\{\}\[\]\|\<\>\?\.\\.
  • The equivalent expression is "~@#&*()-+{}[]|\<>?.\".

The simplest algorithm to create the basic string-finding expression using insource:/"regexp"/, need not take metacharacters into account except for the " and / characters:

  1. Write the/str"ing out. (The /" delimiters "/ are not shown.)
  2. Replace " with "\"" (previous double-quote: stop, concatenate, quote restart).
  3. Replace / with "\/" (stop, concatenate, start).
  4. You get insource:/"the"\/"str"\""ing"/, showing concatenation of the two methods.

The square-bracket notation for creating your own character-class also escapes its 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 character class, the dash character also has special meaning (range) but can 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 character that is either a dash or a right square bracket or a dot: [-.\]] or [].\-].

For general examples using metacharacters

  • insource:"2+2=4" insource:/"2+2=4"/ matches "2 + 2 = 4", with zero spaces between the characters.
  • insource:"2 + 2 = 4" insource:/2 ?\+ ?2 ?= ?4\./ match with zero or one space in between. The equals = sign is not a metacharacter, but the plus + sign is.
  • insource:"<tag>[[link|2\3?]]\</tag>" insource:/"<tag>[[link|2\3?]]<"\/"tag>"/.

There are some notable differences from standard regex metacharacters:

  • The dot . metacharacter stands for any character including a newline, so .* matches across lines.
  • The number # sign means something, and must be escaped.
  • The ^ and $ are not needed. Like "grep" (global per line, regular expression, print each line), each insource:// 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.

Advanced example

For example, using metacharacters to find the usage of a template called Val 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 argument "fmt=commas" having any allowable spaces around it, (it could be the same template call, or a separate one):

hastemplate:val insource:"fmt commas" insource:/\{\{val\|[^}]*fmt *= *commas/ insource:/\{val\| *[-+]?[0-9]{3,4} *[|}]/

It is fast because it uses two filters so that every page the regexp crawls has the highest possible potential. Assuming your search domain is set to ALL, it searches the entire wiki, because it offers no namespace or prefix.

Auxiliary text

Cirrus considers some text in the page to be "auxiliary" to what the page is actually about. Examples include table contents, image captions, and "This article is about the XYZ. For ZYX see ZYX" style links. You can also mark article text as auxiliary by adding the searchaux class to the html element containing the text.

Auxiliary text is worth less than the rest of the article text and it is in the snippet only if there are no main article snippets matching the search.

Lead text

Cirrus assumes that non-auxiliary text that is between the top of the page and the first heading is the "lead in" paragraph. Matches from the lead in paragraph are worth more in article ranking.

Commons search

By default when the search contains the file namespace, Cirrus will search commons as well. You can disable this behavior by adding local: to the search. If you are using a namespace prefix to select the namespace the syntax looks like file:local:foo. If you aren't using a namespace prefix to select the namespace then the syntax looks like local:foo.

See also

Notes and references

  1. task T54656 relates how folded letters are not bolded like direct ASCII letters in the drop down titles.
  2. For the formal definition see the Lucene grammar for regular expressions.