Help:CirrusSearch/ja

で情報を見つけるための最も速い方法は直接探すことです. ページにボックスがあります.

CirrusSearch（シーラスサーチ）は MediaWiki の拡張機能で既定の MediaWiki 検索以上に、強化されたElasticsearchの検索機能が使われています. ウィキメディア財団は、ウィキメディアプロジェクト群のすべてのサイトにシーラスサーチを使っています. このページではシーラスサーチの機能を説明します. 疑問がここで解消しない際には遠慮なくトークページでお尋ねください. 誰かがお答えします.

拡張機能の情報はExtension:CirrusSearchになります.

使い方
単語や語句を入力し、Enter や Return キーを押します. あるいは、虫眼鏡アイコン、または「検索」ボタン、（設定により）「表示」ボタンをクリックしてください. 入力文字と同じ名前のページが存在すれば、直接そのページを表示します. 見つからない場合には、ウィキのすべてのページを検索し、検索語に合致する記事の一覧を表示するか、合致する記事が存在しないことを知らせます.

検索ボックスに入力せずに「」ボタンをクリックすると、追加の検索オプションがある「Special:Search」に移動します（この検索オプションは、検索結果の画面でも常に利用できます）

利用者ページだけを検索するとか、特定の名前空間に検索を絞ることは役立つでしょう. そうするには、その名前空間のチェックボックスをオンにします.

標準では、あなたが個人設定で指定した名前空間だけが検索されます. 登録利用者は、標準で検索する名前空間の設定を自由に変更できます. 個人設定を開き、「検索」(search) タブのチェックボックスを使って指定できます.

Adding additional default namespaces has a side effect of changing the autocomplete algorithm from the default to a somewhat stricter algorithm.

改良点
CirusSearch は、標準の MediaWiki 検索と比較して、主に以下の3つの改良点があります:


 * さまざま言語での検索への対応を改善
 * 検索インデックスの更新の高速化. これにより記事に加えられた変更が大幅に高速に検索結果に反映されるようになります.
 * テンプレートの展開. これにより、内容のうちテンプレートに入っている部分がすべて検索結果に反映されるようになります.

検索インデックスの更新頻度
検索インデックスへの更新はほぼリアルタイムで適用されます. ページを変更するとすぐに、それが検索結果に現れるはずです. テンプレートへの変更は、そのテンプレートを参照読み込みしている記事に反映されるまでに数分かかるはずです. テンプレートへの変更はジョブ・キューを使用するため、パフォーマンスは変化する場合があります. 即座に変更を反映させたい場合は空編集を行うことで、強制的に反映させることが可能です. しかし、これは必ずしも必要ではありません.

検索候補の表示
検索ボックスに入力するとドロップダウンで表示される候補のページは、記事の品質の大まかな評価順に並んでいます. その候補の選別には、ウィキリンクされている数、ページサイズ、外部リンクの数、見出しの数、リダイレクトの数が考慮されます. 検索候補をスキップし、その検索ページを直接表示するには、クエリの先頭にチルダ記号  を1個付けます（例：~Frida Kahlo）. 検索候補は表示されるものの、改行キー (Enter) を押したタイミングで検索結果のページへ移ります. 欧文のASCII表記・アクセント記号・発音区別符号は有効ですが 、検索結果に書式エラーが出ることがあります. 詳細はをご参照ください.

全文検索
「全文検索」は「インデックス検索」です. すべてのページはウィキ・データベースに格納されており、全ての単語はそのウィキの全文を索引にした検索データベースに格納されています. それぞれの知られた単語はそれが見つかったページの一覧として索引にされているので、ある単語の検索は、単一のデータを見つけるごとく早いです. さらにいかなる文言の変更も数秒以内に検索インデックスに反映されます.

ウィキの「全文検索」のインデックスは多数あり、必要な検索のさまざまなタイプに対応しています. ウィキテキスト全体に対して、インデックスを個別の目的ごとに付与し、それに基づいて解析するため、あらゆる方法で柔軟に利用できます. インデックスの例をあげます.


 * 「補助」テキスト ‐ HTML属性 class=searchaux で分類された、ハットノートやキャプション、目次および任意のウィキテキストが含まれます.
 * 「Lead-in」テキスト ‐ ページの上部と最初の見出しの間にあるウィキテキストです.
 * 「カテゴリ」テキスト ‐ ページ最下部の一覧を索引化します.
 * テンプレートのインデックスが作成されます. テンプレートに埋め込み参照された単語の変更により、それを継承するすべてのページが更新されます. （ジョブキューによっては時間がかかります. ）テンプレートが呼び出すサブテンプレートの変更によって、インデックスが更新されます.
 * FileやMediaの名前空間に格納されたドキュメントの内容も、索引化するようになりました. 数千のフォーマットが認識されます.

この機能は多言語で提供されていますが、すべての言語での対応が望まれています. 現在サポートしている言語の一覧は外部サイトelasticsearch.orgにあります. パッチや要望の連絡先は投稿の説明文書を参照してください.

CirrusSearchはクエリを最適化して実行します. 検索結果は近似かどうかで並べ替え、20件ずつ検索結果ページに出力します. 記事から拾った断片を添付し、検索した文字列を太字で表示するなど、後処理を重ねてあります.

検索結果には、しばしばさまざまな予備的な報告が付いています. 「クエリの修正候補」（スペル修正）を示す場合や、どうしても結果が見つからなかった場合には「○○に対する検索結果」（クエリの修正）と（ユーザー指定のクエリの）「代わりに○○を検索」と表示します.

その他の検索機能の要素：


 * 検索結果をリンク元の数で並べ替え.
 * チルダ記号 を先頭に付けて、ページの順位を保存するようなナビゲーションやお奨めを無効化.
 * 文字のスマートマッチング ‐ 外字（キーボードにない文字）をキーボード文字に正規化（または「折りたたむ」）.
 * ヒットした単語や文節を検索結果のページに太字で表示. 強調表示は見た目を分析し、検索インデックス分析機能は実際にページを検出するもので、両者が100％同期しない可能性があります（特に正規表現の場合）. 検出率では、強調表示機能がインデックス分析器能よりもやや正確に一致する場合があります.

語句と修飾子
基本的な検索語は単語もしくは引用記号「"」で挟んだ単語節を使い、検索では「単語」を次のように認識します.


 * 一連の半角数字
 * 一連の文字
 * 文字や数字の間に挟まる部分語. 例： txt2regex の「2」に当たるもの
 * compoundName（複合語）に含まれる部分語をキャメルケースで判定

「ストップワード」はあまりにも一般的などの理由で無視されます (英語の a、the 他). 検索ボックスで指定した文字列はコンテンツ と照合（ページ内でレンダリング処理）します. MediaWikiマークアップを含めた「句」であるウィキ文を検索の対象にするには、 insource 検索を使います（下記の節参照）. 検索のパラメータごとにインデックスが異なり、同じ検索語を指定しても独自の解釈で処理します.

単語や文節、パラメータに含む空白あるいはパラメータへの入力には、ホワイトスペース文字やグレースペース文字をいくつでも含めることができます. 「グレースペース文字」とはアルファベットではない文字すべて ~!@#$%^&*_+-={}|[]\:";'<>?,./ のことです. もしホワイトスペース文字にグレースペース文字 が含まれていると一意に「グレースペース文字」と判断され、一連の大きな文字の集団として扱われます. グレースペーストは索引化とクエリの解釈法を規定します.

例外は2件あります. 1)「 embedded:colon 」 は1単語として処理（文字扱い). 2）例えば「 1,2,3 」など、埋め込まれたカンマ「, 」は数字として扱う. グレースペース文字は左の場合を除くと無視され、クエリの構文の制限により、修飾語句の文字として解釈されます.

修飾語句とは「 ~ * \? - " ! 」のことです. 構文のどの位置にあるかにより、単語、パラメーター、クエリ全体のいずれかを修飾します. 単語および文節を修飾するものは、ワイルドカードと類似検索、あいまい検索です. パラメーターごとに修飾語句が異なる場合もあるものの、一般原則は次のとおりです.


 * あいまい検索では単語もしくは文節に接頭辞としてチルダ記号 （とさらに度合いを示す数字）が付きます.
 * チルダ記号 をクエリの用語の先頭に付けると、不特定数のナビゲーションの代わりに検索結果を確定します.
 * 単語内のワイルドカード記号として、\?（半角円マーク付きの疑問符）は1文字の代用、アステリスク（*印）は2文字以上の代用をします.
 * 真偽ロジックにより「 AND 」と「 OR 」が使えるものの、パラメータは使えません.
 * 真偽ロジックは用語に付いた接頭辞「 - 」または「 ! 」を理解し、用語の通常の意味を「一致」から「除外」に逆転させます.
 * 複数の単語を引用符でまとめると、「完全一致」検索になります. パラメータの場合には複数語の入力の制限解除に必要です.
 * 語幹は自動で処理されるものの、「完全一致」を用いると無効にできます.

文節検索は、検索エンジンにさまざまなヒントを与えて実行します. そのヒントの与え方にはそれぞれ副作用があり、単語の組み合わせに対する検索結果の耐性が異なります. またグレースぺースやキャメルケースあるいはtxt2numberの場合は次のとおりです. 普遍的に知られていない単語が文節で無視されると、「○○の代わりに検索」のレポートが発動します.
 * 「 words-joined_by_greyspace(characters) 」や「 wordsJoinedByCamelCaseCharacters 」を用いると「 words joined by ... characters 」の単語を、そのままの形あるいはグレースペース形で検索.
 * txt2number は もしくは と照合.
 * ストップワードはgrey_spaceまたはcamelCaseのフレーズの（周辺部の）エッジケースに対して有効です. 「 the 」「 of 」「 a 」の使用例では「 the_invisible_hand_of_a 」は と照合.

文節に照合する以下のタイプはそれぞれ、直前のものの照合結果を内包し検出率を向上させます.
 * 「完全一致」「引用符で挟んだ」を選ぶとグレースペースを許容（照合）します. 「 "exact_phrase" 」「 "exact phrase" 」を選ぶと「 」を照合.
 * greyspace_phraseにより語幹処理が始まり、ストップワードを照合.
 * 「 CamelCase 」を選ぶと追加条件として「 」をすべて小文字と認識して照合. 原因はCirrusSearchの照合は大文字小文字を認識しないため.

ページのランキングを使うと、2単語検索の場合に引用符の入力が省略できます. 引用符がない場合、単語のペアの索引を用いてページのランク付けが実行され、さらにそれらがページ上にあればすべて拾い出します.

パラメータによってはグレースペースの文節扱いとなるものの、「 」などのように「通常の引用符で挟んだ複数の単語」として解釈されます.

Note that all stemming is case insensitive.

Note how the "exact phrase" search interpreted the embedded:colon character as a letter, but not the embedded_underscore character. A similar event occurs with the comma, character inside a number.

Given, CirrusSearch, when in an "exact phrase" context, (which includes the insource parameter context), will not match  ,  , or  , but will then only match.

Otherwise, remember that for CirrusSearch words 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. Now camelcase matches camelCase because Search is not case sensitive, but camelCase matches camelcase 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 search parser_function -"parser function" is the sum of the basic searches  and.

Making inquiries with numbers, we would find that: The star * wildcard matches a string of letters and digits within a rendered word, but never the beginning character. One or more characters, a percentage of the word, must precede the * character. The \? wildcard represents one letter or number; The *\? is also accepted, but \?* is not recognized.
 * Plan9 or Plan_9 matches any of:,  ,  ,  ,
 * "plan9" only matches  (case insensitive)
 * Plan*9 matches  or.
 * If the leading part is only letters then it will limit a match to a string of (zero of more) letters.
 * If only numbers, then it will limit a match to a sequence of (zero or more) numbers, including also ordinal letters (st, nd, rd), capital letters, or time abbreviations (am or pm); and it will match the entirety of (both sides of) a decimal numbers.
 * Otherwise the comma is considered part of one number, but the decimal point is considered a greyspace character, and will delimit two numbers.
 * Inside an "exact phrase" it matches stemming plus compounding.

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.
 * For a phrase it is termed a proximity search, because proximal words are tolerated to an approximate rather than exact phrase.
 * For example, "exact one two phrase"~2 matches.
 * For a word it means extra characters or changed characters.
 * For a phrase a fuzzy search requires a whole number telling it how many extra words to fit in, but for a word a fuzzy search can have a decimal fraction, defaulting to word~0.5 ( word~.5 ), where at most two letters can be found swapped, changed, or added, but never the first two letters.
 * For a proximity phrase, a large number can be used, but that is an "expensive" (slow) search.
 * For a word word~2 is most fuzzy with an edit distance of 2 (default), and word~1 is least fuzzy, and word~0 is not fuzzy at all.

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, see Elasticsearch slop. An explicit AND is required between two phrases because otherwise the two "inner" "quotation marks" are confused. Quotes turn off stemming, "but appending"~ the tilde reactivates the stemming.

insource検索
Insource検索では、ページにレンダリングされた「語」だけでなく、MediaWikiマークアップを含めた「句」を検索することができます. ここでいう「句」は、グレースペース (greyspace) を完全に無視します. 例えば、 insource: "state state autocollapse" は にマッチします. 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. Regex 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 must run more than twenty seconds. Regex run last, so to limit needless character-level scanning, you advance it a list of pages (a search domain) selected by an indexed search added to the query as a "clause", and you do this to every single regex query. . Insource can play both roles, and the best candidate for insource:/arg/ is often insource: arg, where arg is the same.

The syntax for the regexp is insource: no space, and then /regexp/. (No other parameter disallows a space. All the parameters except insource:/regexp/ generously 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 regex are the only way to find an exact string of any and all characters, for example a sequence of two spaces. Regex 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 below.
 * Both search wikitext only.
 * Neither finds things "sourced" by a transclusion.
 * Neither does stemmed, fuzzy, or proximity searches.
 * Both want the fewest results, and both work faster when accompanied by another clause.

接頭辞と名前空間
検索では、名前空間の単語は初期の検索ドメインを指定します. ウィキ全体を検索する代わりに、既定では標準名前空間 (main namespace, mainspace) を検索対象とします.

検索ボックスのクエリにおいては単一の名前空間のみ設定できます. 接頭辞パラメーターの、最初もしくは最後の単語を指定すると簡単です.

検索結果を表示するたび、Special:Searchページの上部に現われる検索バーにあるAdvanced枠には2個以上の名前空間を入力して検索できます. ここで検索対象のドメインは名前空間のプロフィールとして設定します（利用者の個人設定ページを開く必要はありません）. このときの名前空間の一覧は、将来の検索時に1ページ目に表示され、検索結果の検索対象ドメインがわかります. この設定を解除するには、既定の名前空間（丸カッコ内に表示）を選択、「記憶」を選んで「検索」ボタンを押します.

The search 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 a prefix term overrides a namespace.

Enter a namespace name, or enter, or enter a     colon for mainspace. All does not include the File namespace. File includes media content held at Commons such as PDF, which are all indexed and searchable. When File is involved, a namespace modifier  has an effect, otherwise it is ignored. Namespace aliases are accepted. As with search parameters, local and all must be lowercase. Namespaces names are case insensitive.

The prefix: parameter matches any number of first-characters of all pagenames in one namespace. 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 or ' quote or " double quote. The last character cannot be a colon. For pagenames that match, their subpage titles match by definition. The prefix parameter does not allow a space before a namespace, but allows whitespace before a pagename.

The prefix parameter goes at the end so that pagename characters may contain " quotation marks.

The Translate extension creates a sort of "language namespace", of translated versions of a page. But unlike namespace or prefix, which create the initial search domain, the inlanguage parameter is a filter of it. (See the next section.)

Exclude content from the search index
Content can be excluded from the search index by adding. This will instruct CirrusSearch to ignore this content from the search index (see for more context).

Additionally content can be marked as auxiliary information by adding. 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.

Filters
A filter can have multiple instances, and negated instances, and it can run as a standalone filtering a search domain. A query is formed as terms that filter a search domain. A namespace or a prefix term is not a filter because a namespace will not run standalone, and a prefix will not negate.

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).

The search parameters below are filters.

Insource (covered above) is also a filter, but insource:/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 titles only or category only.

Intitle and incategory are old search parameters. Incategory no longer searches any subcategory automatically, but you can now add multiple category pagenames manually.
 * cow*
 * Find articles whose title or text contains words that start with cow
 * intitle:foo
 * foo をタイトルに含む記事を検索します. 語幹解釈は有効です.
 * intitle:"fine line"
 * fine line の文字列をタイトルに含む記事を検索します. 語幹解釈は無効です.
 * intitle:foo bar
 * foo をタイトルに含み、かつ、bar をタイトルまたは本文に含む記事を検索します.
 * -intitle:foo bar
 * foo がタイトルに含まれず、かつ、bar がタイトルまたは本文に含まない記事を検索します.
 * incategory:Music
 * Category:Music に属する記事を検索します.
 * incategory:"music history"
 * Category:Music_history に属する記事を検索します.
 * incategory:"musicals" incategory:"1920"
 * Category:Musicals と Category:1920 の両方に入っている記事を検索します.
 * -incategory:"musicals" incategory:"1920"
 * Category:Musicals には入っておらず、Category:1920 に入っている記事を検索します.

Deepcategory
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 uses SPARQL Category service from WDQS. Keywords are deepcategory or deepcat. Example:
 * deepcat:"musicals"
 * Find articles that are in Category:Musicals or any of the subcategories.

Previously this parameter was implemented by a gadget: to get the search parameter deepcat, to automatically add up to 70 subcategories onto an incategory parameter, incategory:category1|category2|...|category70 , you can add a line to your Custom JavaScript.

Linksto
Linksto finds wikilinks to a given name, not links to content. The input is the canonical, case sensitive, page name. 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. .)

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:
 * 1) linksto: "Help:Cirrus Search"
 * 2) linksto: Help:Searching
 * 3) linksto: H:S

finds articles that mention "CirrusSearch" but not in a wikilink.

Hastemplate
You can specify template usage with. Input the canonical pagename to find all usage of the template, but use any of its redirect pagenames finds just that naming. Namespace aliases are accepted, capitalization is entirely ignored, and redirects are found, all in one name-search. (Compare boost-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 for words and phrases from a template, but here it's for templates from a template. The page will be listed as having that content even though that content is not seen in the wikitext.


 * hastemplate: "quality image", finds "Template:Quality image" usage in your default search domain (namespaces).
 * : hastemplate: portal:contents/tocnavbar, finds mainspace usage of a "Contents/TOCnavbar" template in the Portal namespace.

For installations with the Translate extension, hastemplate searches get interference wherever Template:Translatable template name wraps the template name of a translatable template. Use insource instead.

Inlanguage
For installations with the Translate extension, inlanguage is important for highly refined searches and page counts.


 * inlanguage: language code

will produce search results in that language only.

例えば


 * to count all Japanese pages on the wiki
 * all: inlanguage: ja


 * to filter out German and Spanish pages in the Help namespace
 * help: -inlanguage: de -inlanguage: es


 * to ignore Translate, and where English is the base language, add
 * inlanguage:en

Contentmodel
The contentmodel: keyword allows to limit the search to pages of a specific content model. For possible models cf. Content handlers. E.g.:


 * To see only JSON pages:
 * contentmodel:json

subpageof
To find sub-pages.
 * subpageof: ParentPage

For example


 * To find all subpages of CirrusSearch.
 * subpageof:CirrusSearch


 * Use double quotes if the parent page contains spaces.


 * subpageof:"Requests for comment"

NOTE: unlike prefix:, do not include the page namespace in the keyword value. If you want to limit to sub-pages of a particular namespace use the namespace filter.

Page weighting
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 any explicit phrases to your search, or for certain other additions, this "prefer phrase" feature is not applied.

Morelike
照会を使えるのは入力する記事から文節を選んだときで、その文節で照会をかけます. 動作を調整するには、検索結果の URL に以下のパラメータを追加します: これらの設定を永続化するには Help:System message の   を無効にする.
 * morelike:page name 1|page name 2|...|page name n
 * 指定した記事と文章がもっとも似たものを探す.
 * 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.
 * : 文書 (分割データベースごと) で、判断に必要な用語を 1 つ要求するときの最小値.
 * : 文書 (分割データベースごと) で、判断に必要な用語を 1 つ要求するときの最大値.
 * : 判断する用語の最大値.
 * : 判断すべき docの入力について用語が出現する最小値. フィールドが小さい場合は . 既定値は必ず 1.
 * : 判断すべき用語の長さの最小値. 既定値は 0.
 * : 単語を無視する場合の上限値. 既定値は無限 (0).
 * (コンマで区切った値のリスト): これらをフィールドとして使用. 許容フィールドは  、 、 、 、   および.
 * ( | ): 使用はフィールドデータに限定.   既定値: システムは   の内容からフィールドを抽出、照会を作成.
 * : 一致する用語のパーセント. 既定値は 0.3 (30 percent).
 * 例:

Prefer-recent
Adding prefer-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 default  sort 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 as prefer-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,recent Technically "boost" is the proportion of score to scale, and "recent" is the half life in days. The boost is more than the usual multiplier, it is an exponential boost. The factor used in the exponent is the time since the last edit.

例えば
 * prefer-recent:,7

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.
 * prefer-recent:1,7 (weeks)
 * prefer-recent:1,1 (days)
 * prefer-recent:1,0.0007 (minutes)
 * prefer-recent:1,0.0001 (8.64 seconds)
 * prefer-recent:1,0.00001 (seconds)

Boost-templates
You can boost pages' scores based on what templates they contain. This can be done directly in the search via  or you can set the default for all searches via the new   message. replaces the contents of  if the former is specified. The syntax is a bit funky but was chosen for simplicity. Like prefer-recent, boost-templates is only applied when using the default  sort order. 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  message this can be reduced to just.

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 : 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  would find a featured article with those words scattered throughout it instead of the article for Brave New World.

正規表現の検索
A basic indexed-search finds words rendered visible on a page. Hyphenation and punctuation marks and bracketing, slash and other math and computing symbols, are merely boundaries for the words. It is not possible to include them in an indexed search.

These return much much faster when you limit the regexp search-domain to the results of one or more index-based searches.

Warning: Do not run a bare insource:/regexp/ search. It will probably timeout after 20 seconds anyway, while blocking responsible users.

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:"debian.reproducible.net" insource: / debian\.reproducible\.net / 
 * insource:"c:\program files (x86)" insource: / C\:\\Program Files \(x86\) /i 
 * insource:"{ {template}}" insource: / "{ {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: finds the term regex 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. at Special: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 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 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: To test a bare regexp query you can create a page with test patterns, and then use the prefix parameter with that fullpagename. The match will be highlighted. It searches that page (in the database) and its subpages.
 * 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.

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 metacharacters used in rexexp searches For the actual meaning of the metacharacters see the explanation of the syntax.

例:


 * to search a namespace, gauge the number of pages with a single term that is a namespace. This will list the number of pages in that namespace.
 * starting out to find again what you may have seen, like "wiki-link" or "(trans[in]clusion)" start with namespace and insource filters.

Refining with an exact string

 * refinining an ongoing search process with what you want to see, like "2 + 2 = 4", or "site.org" This is ideally the best use of regex, because it adds it as a single regexp term while refining a search, the limited number of pages the regexp must crawl is can be seen.

You can start out intending an exact string search, but keep in mind:


 * 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. 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. Escaping with quotes is cleaner.
 * 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.


 * instead of
 * is as good as
 * But  always.
 * And .  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 escaped metacharacters would be.
 * The equivalent expression escaped with double-quotes 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   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 , 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 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: There are some notable differences from standard regex 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:"[ [link|2\3?]]\" insource:/"[ [link|2\3?]]< "\/" tag>"/.


 * The  or   are not reserved for matching a newline. To search for a string that contains a newline, you can do a search like   which means not a curly brace, then two curly braces, then any two characters except a curly brace, space, or pipe, then a  tag. The "any character except" will include a newline in the search. Note thas this search was designed only to match to the following string:
 * 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.
 * 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.
 * 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 on titles
The insource keyword does only search the page source content. To run regex searches on the title strings intitle:// can be used.

高度な例
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 having any allowable spaces around it, (it could be the same template call, or a separate one):



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.

bounded
特定の地理座標の近くにあるとわかっている事物のページに検索対象を限定することができます. 座標は、緯度と経度の組を直接指定することも、座標の元となるページ名を入力することもできます. 検索する範囲を限定したい場合は、最初にその範囲を入力します. 例:


 * neartitle:"San Francisco"
 * neartitle:"100km,San Francisco"
 * nearcoord:37.77666667,-122.39
 * nearcoord:42km,37.77666667,-122.39

boosted
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.


 * boost-neartitle:"San Francisco"
 * boost-neartitle:"100km,San Francisco"
 * boost-nearcoord:37.77666667,-122.39
 * boost-nearcoord:42km,37.77666667,-122.39

File properties search
Since MediaWiki 1.28, CirrusSearch supports indexing and searching of properties of files in the  namespace. This includes:
 * file media type
 * MIME type
 * size
 * width & height
 * resolution
 * bit depth for files that support these

filetype
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:



This list may be extended in the future. See also  constants in.

The syntax of the search is: filetype:{type}. Example:

filetype:video - looks for all videos

The filetype search is not case-sensitive.

filemime
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.

例:

filemime:"image/png" - look for files with MIME type exactly

filemime:pdf - look for all PDF documents

The MIME type search is not case sensitive.

filesize
Search for file of given size, in kilobytes (kilobyte means 1024 bytes). The syntax is:

filesize:{number} or filesize:>{number} - file with size at least given number

filesize:<{number} - file with size no more than given number

filesize:{number},{number} - file with size between given numbers

例:

filesize:>20 or filesize:20 - files 20KB and bigger

filesize:<1024 - files smaller than 1MB

filesize:100,500 - files with sizes between 100KB and 500KB

File measures
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:

{measure}:{number} - file with measure that equals to given number

{measure}:>{number} - file with measure that is at least given number

{measure}:<{number} - file with measure that is no more than given number

{measure}:{number},{number} - file with measure that is between given numbers

Where  can be:

filew or filewidth - file width

fileh or fileheight - file height

fileres - file resolution (see above)

filebits - file bit depth

例:

filew:>800 fileh:>600 - files that are at least 800x600 pixels in size

filebits:16 - files with 16-bit color depth

fileheight:100,500 - file between 100 and 500 pixels high

Wikibase search
Wikibase extension defines some search keywords in order to make it easier to search for certain Wikibase items. Currently this is useful only on Wikidata sites.

haswbstatement
Returns the items that have specific value in statement with specific property. Works for all properties with "external identifier", "string", "item", "property", "lexeme", "form" and "sense" datatypes, except and, which are currently omitted for performance reasons.

For example, for item with value of in property  use:   and for item with value "113230702" in property  use. You can also make queries without a specified value, e.g. for all items with property (in main value) use.

To search for items that do not have a certain statement, add an “exclude” modifier, for example.

Cross-wiki search results
The search on Wikimedia projects includes improved cross-wiki search results (also known as interwiki search results, sister projects search results).

Explicit sort orders
In addition to the default relevance based sort CirrusSearch can provide results a few other explicit sort orders. Specifying a sorting order other than  will disable all search keywords that effect scoring, such as   or. The keywords will still be parsed, but they will have no effect.

Sorting options are currently available from the MediaWiki API by providing the  parameter.

Sorting options can be manually added to a search URL by adding, for example https://www.mediawiki.org/w/index.php?search=foo&sort=last_edit_desc.

Valid sort orders include:

Interface for advanced options


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

関連項目

 * Completion Suggester - CirrusSearchの機能強化版
 * Wikimedia Discovery/Search/Glossary - definitions, context, and links for terms related to search.
 * Search/Old - CirrusSearchの開発と展開の道のり
 * Help:Searching - 検索拡張機能を備えないウィキで人気のMWSearch
 * Help:Searching - 検索拡張機能を備えないウィキで人気のMWSearch

外部リンク

 * From Lucene - クエリの概念を的確に解説


 * Extension:CirrusSearch/Profiles - sets of tunable parameters that influence various aspect of the indexing
 * Wikimedia blog articles related to search
 * Wikimedia blog articles related to search