Help:CirrusSearch/zh

CirrusSearch是MediaWiki的新搜索引擎. Wikimedia基金会正在向CirrusSearch迁移，因为它相比于先前的搜索引擎LuceneSearch具有关键性改进. 该页将会说明新的功能或与旧版的差异.

常见问题
如果你的疑问并未得到解答，请在讨论页提问，热心用户将会为你解答. Help talk:CirrusSearch

作了哪些改进？
新搜索引擎较之于旧搜索引擎有三大改进，即：


 * 更好的支持以不同语言搜索.
 * 更快的更新搜索索引，即页面修改能更快在搜索引擎中显示出来.
 * Expanding templates, meaning that all content from a template is now reflected in search results.

更新
搜索结果的索引列表会被及时更新. 当你改变了关键字时，新的结果也能立即显示处理. 对模板的变更将会在数分钟内起作用. 由于采用任务调度模式来处理这些变更，所以实际情况可能略有不同. 对文章的编辑，即使不包含任何改变，也会强制系统进行刷新——所以正常情况下不要进行这样的操作. 你可以在改变输入内容时立即得到搜索结果. Changes to templates should take effect in articles that include the template in a few minutes. The templates changes use the job queue, so performance may vary. A null edit to the article will force the change through, but that shouldn't be required if everything is going well.

搜索建议
当你在搜索框中键入关键字时，下拉框提供的搜索建议的排列顺序与各词条所拥有的导入链接数有关. 如果你在关键词前加入“～”，将不会匹配任何词条. 同时，你可以随时按回车键进入搜索结果页.

ASCII/accents/diacritics folding is turned on for English text, but there are some formatting problems with the result. See 52656.

全文搜索
全文搜索功能（类似“在结果页中查找”）会搜索网页标题、重定向链接、小标题以及正文，所以搜索结果相对稳定. 本次主要的改动在于模板的扩充.

Stemming
There is support for dozens of languages, but all languages are wanted. There is a list of currently supported languages at elasticsearch.org; see their documentation on contributing to submit requests or patches.

过滤器（intitle: 、incategory: 和linksto: ）


我们对以下这些搜索语法进行了强化：


 * intitle:foo
 * 查找标题包含foo的条目. 词干提取对foo启用.
 * intitle:"foo bar"
 * 查找标题同时包含foo和bar的条目. 词干提取对foo和bar启用.
 * intitle:foo bar
 * 查找标题包含foo或包含bar的条目.
 * -intitle:foo bar
 * 查找标题既不包含“foo”、也不包含“bar”的词条.
 * intitle: foo bar
 * 这是错误的语法. 将查找标题或内容包含“foo”或包含“bar”的词条.
 * incategory:Music
 * 查找属于“Music”分类的词条
 * incategory:"music history"
 * 查找属于“Music_history”分类的词条
 * incategory:"musicals" incategory:"1920"
 * 查找同时属于“Musicals”和“1920”分类的词条
 * -incategory:"musicals" incategory:"1920"
 * 查找属于“1920”分类，但不属于“musicals”的词条
 * cow*
 * 查找标题或正文中包含以“cow”开头词汇的词条
 * linksto:Help:CirrusSearch
 * 查找含有链接的词条
 * -linksto:Help:CirrusSearch CirrusSearch
 * 查找一篇包含“CirrusSearch”字样，但本身并不含有链接的词条Help:CirrusSearch

prefix:
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.


 * prefix:cow
 * 查找所有标题以“cow”开头的词条.
 * domestic prefix:cow
 * 查找所有包含“domestic”并且标题以“cow”开头的词条.
 * domestic prefix:Cow/
 * 查找所有包含“domestic”并且属于“Cow”词条的子页面，这一方法较为常用. 一般通过加入URL参数 来构造这一请求.
 * domestic prefix:Talk:Cow/
 * 查找所有包含“domestic”，并且属于“Cow”讨论页的子页面.
 * cow prefix:Pink Floyd/
 * 查找所有包含“cow”，并且属于“Pink Floyd”词条的子页面. 这里的空格不影响搜索结果.

注意：“prefix：”仍然需要放在查询语句的末尾.

特殊前缀

 * Find articles whose text is most similar to the text of the given articles.
 * Find articles in the talk namespace whose title or text contains the word foo
 * Find articles in the file namespace on this wiki and commons whose title or text contains the word
 * You can add  to the query (like  ) to remove the results from commons
 * Find articles in the file namespace on this wiki and commons whose title or text contains the word
 * You can add  to the query (like  ) to remove the results from commons
 * You can add  to the query (like  ) to remove the results from commons
 * You can add  to the query (like  ) to remove the results from commons

您是想找
“您是想找”功能可以在用户出现拼写错误时提供搜索建议. 如果搜索词不寻常（可能是输入错误），它将会给予提示，同时给出可能的正确拼写形式.

优先短语匹配
如果你没有使用特定的语法，我们将尝试找出最佳匹配的短语. 我们会有意地做到“模糊”查询，因为我们无法确定究竟什么样的语法是“最准确的”（这取决于查询者的意图）. 如果你使用了任何显式的语法结构，这一功能将不会被启用.

模糊搜索
在搜索词后加上“～”表示启用模糊搜索. 你也可以用数字0-1来控制“模糊”程度，如“nightmare~.9”、“lighnin~.1”或“ighnin~0.1”，其中1表示最“精确”，9表示最“模糊”.

近似短语搜索
用引号包含的关键词表示对其进行完全匹配查询. 你同样可以在后面加上一个表示“近似程度”的数字（准确的说法是“语义梯度”）. 默认的“语义梯度”值为1.

引用与精确匹配
一些情况下，您还可以点击浏览器中的‘后退’按钮返回到链接媒体查看器中图像的页面.

prefer-recent:
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 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.

hastemplate:
You can find pages that use a certain template by adding the filter  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: , and for that same template name in the main namespace, this works. You can omit the quotes if the template title does not contain a space. 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.

boost-templates:
你可以根据所用模板不同来调整搜索结果的排列顺序，比如 ；或使用新语法 来设置默认选项（通过发送系统消息）. 会取代 的设置（如果后者已经被设置的话）. 这一语法很特别，但若使用得当则能简化搜索. 以下是一些例子：


 * 查找“China”分类下的文件，并将高质量的图片排列在最前.
 * 查找“China”分类下的文件，并将高质量的图片排列在最前.


 * 查找“China”分类下的文件，并将高质量的图片排列在最前、低质量的图片排列在最后.
 * 查找“China”分类下的文件，并将高质量的图片排列在最前、低质量的图片排列在最后.


 * 查找有关“popcorn”的文件，并将高质量的图片排列在最前、低质量的图片排列在最后. 通过使用 语法（消息），可以将这一搜索简化为.
 * 查找有关“popcorn”的文件，并将高质量的图片排列在最前、低质量的图片排列在最后. 通过使用 语法（消息），可以将这一搜索简化为.

不要在表示比例的百分数中添加小数点. 这样做不会起作用，而且搜索结果也不会有很大差别.

使用警告：如果你在排序比例中设置了一个非常大或非常小的值，全文搜索将会受到影响. 比如，将词条排序比例设置为100,000,000%，那么系统将会优先匹配每个单词所对应的文章，而不是搜索语句本身所匹配的文章；同时，语法匹配功能也无法起作用. 结果，类似 的搜索将会匹配全文中包含“brave”、“new”、“world”三个词的词条，而不是词条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.

insource:
will search text just in the wikitext. This will pick up template parameter names, URLs in link tags, etc. It has two flavors:
 * and
 * These work pretty similarly to  or regular content search in that they are fast but ignore punctuation.


 * and
 * These run Regular expressions against the page wikitext. They aren't efficient and we only allow a few of them to run at a time on the search cluster, but they are very powerful. The version with the extra  runs the expression case insensitive, and is even less efficient.


 * Tip: Instead of running insource: searches directly, these return much much faster if they always run on filtered results, such as:
 * Regex characteristically need to be honed before being released in the wild. To sharpen a new /regex/ for a wiki-side search, simply start with an intitle: filter of an article-space pagename, or for any other namespace, such as your user sandbox, use a prefix: filter on a fullpagenames. In article space a prefix: search works just as well, but its syntax is less intuitive, because prefix: must go after, but it still filters firstly.
 * Regex characteristically need to be honed before being released in the wild. To sharpen a new /regex/ for a wiki-side search, simply start with an intitle: filter of an article-space pagename, or for any other namespace, such as your user sandbox, use a prefix: filter on a fullpagenames. In article space a prefix: search works just as well, but its syntax is less intuitive, because prefix: must go after, but it still filters firstly.
 * Regex characteristically need to be honed before being released in the wild. To sharpen a new /regex/ for a wiki-side search, simply start with an intitle: filter of an article-space pagename, or for any other namespace, such as your user sandbox, use a prefix: filter on a fullpagenames. In article space a prefix: search works just as well, but its syntax is less intuitive, because prefix: must go after, but it still filters firstly.
 * Regex characteristically need to be honed before being released in the wild. To sharpen a new /regex/ for a wiki-side search, simply start with an intitle: filter of an article-space pagename, or for any other namespace, such as your user sandbox, use a prefix: filter on a fullpagenames. In article space a prefix: search works just as well, but its syntax is less intuitive, because prefix: must go after, but it still filters firstly.


 * If the regexp contains whitespace, you must either backslash-escape each space character,, or put everything after insource: in quotes,  . The metacharacters   must be backslash-escaped or escaped by virtue of being in a character class in square brackets like   or  , or else they have their usual metacharacter meaning. See the explanation of the syntax and the Lucene grammar for regular expressions.


 * For example, to find usage of a template called Val with an unnamed parameter of four-digits having a possible minus sign and, on the same page, Val with a named parameter "fmt=commas":

辅助文本
Cirrus Search将页面中的某些内容视为“辅助文本”，如表格内容、图片标题，以及诸如“这是一篇关于XYZ的文章. 有关ZYX，请参见”的链接. 可以通过在html中添加class属性 来将某一文本标记为辅助文本.

辅助文本与其余文本相比显得次要. 所以仅当其余的文段无法匹配的搜索词时，辅助文本才会显示在结果片段中.

开头文本
Cirrus Search假定介于页面标题和第一个小标题直接的非辅助文本为＂导语＂段落. ＂导语＂中的匹配结果将在很大程度上影响搜索结果的排列顺序.

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

参见

 * Full specifications in the browser tests