Jump to content

Help:Searching/Features

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Cpiral (talk | contribs) at 20:40, 10 July 2015 (New page for transclusion into many documentation pages where its higher visibility will lead to better sustainability). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)


Hastemplate

Hastemplate searches the contents of what a template transcludes. For example, a template normally transcludes its documentation, and so anything hastemplate finds in that documentation page also lists that template page.

This added level of thoroughness can be compared to the word search: it searches the wikitext, not the displayed page. So a browser search will not find what search found inside a link, because of the link display label changed its appearance.

Hastemplate finds what is deployed:

  • hastemplate will not list pages that make that template's sub-template call
  • hastemplate will not list pages with templates inside comments
  • hastemplate will not count templates inside nowiki tags
  • hastemplate will count templates inside parser functions and other templates, as long as the template is wrapped with double curly braces.

Hastemplate is case-insensitive.

To overcome confusion when trying to locate a template in the wikitext that is only there virtually, as a secondary, meta-template, use the insource parameter instead.

Insource

Insource has a dual role:

  • insource:"quotes-delimited arguments" finds only whole, alphanumeric words, adjacent to one another in that sequence in the wikitext, treating the entire set of non-alpanumeric characters between them as if they were whitespace. For example insource:"M S" matches m/s, as do insource:"M-S" and insource:"m=s"; they all have two arguments, and what matched is shown in bold.
  • Plain insource:word1 word2 has one argument, word1. The words after word1 are treated normally: they're all ANDed as whole words (never as pieces or patterns) OR their word stems, anywhere in the wikitext of the page, and in any sequence; and the match is not shown in bold. (Intitle acts the same way around the "quotes" syntax.)
  • Insource:/slash delimited argument/ finds everything, even comments. It only ever has one argument. What matched is shown in bold text.
  • Insource:/regexp/ finds everything, even pieces and parts, conveying no notion of "words", but only that of a character in an adjacent position to another character in a sequence.
  • Insource:/regexp/ requires you to use \/ for any slash character in the pattern for an obvious reason. It also requires you to "backslash-escape" other metacharacters for various other reasons.

For insource: spaces are not allowed after the colon; it's insource:", or insource:/ for good reasons.


Insource "with quotes" is a safe and sufficient way to find many kinds of template usage. Say the target string is {{Val|9999|ul=AU|fmt=commas}}:

  • insource:"val 9999 ul AU fmt commas" → match
  • hastemplate: val insource:"9999 ul" → match
  • hastemplate: val insource:"999" → no match
  • hastemplate: val insource:"fmt commas" → match
  • hastemplate: val insource:"ul AU" → match
  • hastemplate: val insource:"ul au" → match
  • hastemplate: val insource:fmt → match

In some cases there might be disadvantages. The insource:"quotes version", is case insensitive and blind to non-alphanumeric characters. In other cases it is an advantage to have more search results than intended. For thorough precision, use /regex/.