Go to the documentation of this file.
72 public function supports( $feature ) {
76 case 'title-suffix-filter':
90 $this->features[$feature] = $data;
148 $allSearchTerms =
array( $searchterm );
151 $allSearchTerms = array_merge( $allSearchTerms,
$wgContLang->autoConvertToAllVariants( $searchterm ) );
155 if ( !
wfRunHooks(
'SearchGetNearMatchBefore',
array( $allSearchTerms, &$titleResult ) ) ) {
159 foreach ( $allSearchTerms
as $term ) {
161 # Exact match? No need to look further.
163 if ( is_null(
$title ) ) {
167 # Try files if searching in the Media: namespace
176 # See if it still otherwise has content is some sane sense
178 if ( $page->hasViewableContent() ) {
186 # Now try all lower case (i.e. first letter capitalized)
192 # Now try capitalized string
198 # Now try all upper case
204 # Now try Word-Caps-Breaking-At-Word-Breaks, for hyphenated names etc
219 # Entering an IP address goes to the contributions page
220 if ( $wgEnableSearchContributorsByIP ) {
227 # Entering a user goes to the user page whether it's there or not
232 # Go to images that exist even if there's no local page.
233 # There may have been a funny upload, or it may be on a shared
234 # file repository such as Wikimedia Commons.
242 # MediaWiki namespace? Page may be "implied" if not customized.
243 # Just return it, with caps forced as the message system likes it.
248 # Quoted term? Try without the quotes...
250 if ( preg_match(
'/^"([^"]+)"$/', $searchterm,
$matches ) ) {
258 return "A-Za-z_'.0-9\\x80-\\xFF\\-";
269 $this->limit = intval(
$limit );
270 $this->offset = intval(
$offset );
305 if ( strpos(
$query,
':' ) ===
false ) {
310 $allkeyword =
wfMessage(
'searchall' )->inContentLanguage()->text() .
":";
311 if ( strncmp(
$query, $allkeyword, strlen( $allkeyword ) ) == 0 ) {
313 $parsed = substr(
$query, strlen( $allkeyword ) );
314 } elseif ( strpos(
$query,
':' ) !==
false ) {
317 if ( $index !==
false ) {
322 if ( trim( $parsed ) ==
'' ) {
356 global $wgSearchEverythingOnlyLoggedIn;
362 if ( !$wgSearchEverythingOnlyLoggedIn ||
$user->isLoggedIn() ) {
363 if (
$user->getOption(
'searcheverything' ) ) {
364 return array_keys( $searchableNamespaces );
369 foreach ( $searchableNamespaces
as $ns =>
$name ) {
370 if (
$user->getOption(
'searchNs' . $ns ) ) {
386 return array( $contextlines, $contextchars );
395 global $wgNamespacesToBeSearchedDefault;
397 return array_keys( $wgNamespacesToBeSearchedDefault,
true );
411 foreach ( $formatted
as $key => $ns ) {
412 if ( empty( $ns ) ) {
413 $formatted[$key] =
wfMessage(
'blanknamespace' )->text();
425 global $wgNamespacesToBeSearchedHelp;
427 return array_keys( $wgNamespacesToBeSearchedHelp,
true );
436 function filter( $text ) {
438 return trim( preg_replace(
"/[^{$lc}]/",
" ", $text ) );
454 if (
$type && in_array(
$type, $alternatives ) ) {
456 } elseif ( $wgSearchType !==
null ) {
457 $class = $wgSearchType;
460 $class =
$dbr->getSearchEngine();
463 $search =
new $class(
$dbr );
474 global $wgSearchType, $wgSearchTypeAlternatives;
476 $alternatives = $wgSearchTypeAlternatives ?:
array();
477 array_unshift( $alternatives, $wgSearchType );
479 return $alternatives;
515 function delete( $id,
$title ) {
525 global $wgOpenSearchTemplate, $wgCanonicalServer;
526 if ( $wgOpenSearchTemplate ) {
527 return $wgOpenSearchTemplate;
533 return $wgCanonicalServer .
wfScript(
'api' ) .
'?action=opensearch&search={searchTerms}&namespace=' . $ns;
548 return $c ? $c->getTextForSearchIndex() :
'';
567 # # Some search engines may bail out if too many matches are found
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
setFeatureData( $feature, $data)
Way to pass custom data for engines.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
static searchableNamespaces()
Make a list of searchable namespaces and their canonical names.
normalizeText( $string)
When overridden in derived class, performs database-specific conversions on text to be used for searc...
searchTitle( $term)
Perform a title-only search query and return a result set.
static userHighlightPrefs()
Find snippet highlight settings for all users.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
static defaultNamespaces()
An array of namespaces indexes to be searched by default.
replacePrefixes( $query)
Parse some common prefixes: all (search everything) or namespace names.
textAlreadyUpdatedForIndex()
If an implementation of SearchEngine handles all of its own text processing in getTextFromContent() a...
to move a page</td >< td > &*You are moving the page across namespaces
static factory(Title $title)
Create a WikiPage object of the appropriate class for the given title.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
Array $features
Feature values *.
static getOpenSearchTemplate()
Get OpenSearch suggestion template.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
searchText( $term)
Perform a full text search query and return a result set.
wfRunHooks( $event, array $args=array(), $deprecatedVersion=null)
Call hook functions defined in $wgHooks.
static isIP( $name)
Does the string match an anonymous IPv4 address?
A SearchResultSet wrapper for SearchEngine::getNearMatch.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
filter( $text)
Return a 'cleaned up' search string.
when a variable name is used in a it is silently declared as a new masking the global
static helpNamespaces()
Return the help namespaces to be shown on Special:Search.
updateTitle( $id, $title)
Update a search index record's title only.
setNamespaces( $namespaces)
Set which namespaces the search should include.
update( $id, $title, $text)
Create or update the search index record for the given page.
presenting them properly to the user as errors is done by the caller $title
static getNearMatchResultSet( $searchterm)
Do a near match (see SearchEngine::getNearMatch) and wrap it into a SearchResultSet.
Allows to change the fields on the form that will be generated $name
if(!defined( 'MEDIAWIKI')) if(!isset( $wgVersion)) $matches
static getNearMatchInternal( $searchterm)
Really find the title match.
getTextFromContent(Title $t, Content $c=null)
Get the raw text for updating the index from a content object Nicer search backends could possibly do...
static legalSearchChars()
transformSearchTerm( $term)
Transform search term in cases when parts of the query came as different GET params (when supported) ...
setShowSuggestion( $showSuggestion)
Set whether the searcher should try to build a suggestion.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Contain a class for special pages.
Dummy class to be used when non-supported Database engine is present.
Base interface for content objects.
Represents a title within MediaWiki.
static getNearMatch( $searchterm)
If an exact title match can be found, or a very slightly close match, return the title.
the value to return A Title object or null whereas SearchGetNearMatch runs after $term
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
wfFindFile( $title, $options=array())
Find a file.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
static create( $type=null)
Load up the appropriate search engine class for the currently active database backend,...
setLimitOffset( $limit, $offset=0)
Set the maximum number of results to return and how many to skip before returning the first.
static getSearchTypes()
Return the search engines we support.
static namespacesAsText( $namespaces)
Get a list of namespace names useful for showing in tooltips and preferences.
static userNamespaces( $user)
Extract default namespaces to search from the given user's settings, returning a list of index number...