|
MediaWiki
REL1_19
|
Contain a class for special pages. More...

Public Member Functions | |
| __construct ($db=null) | |
| acceptListRedirects () | |
| If this search backend can list/unlist redirects. | |
| filter ($text) | |
| Return a 'cleaned up' search string. | |
| normalizeText ($string) | |
| When overridden in derived class, performs database-specific conversions on text to be used for searching or updating search index. | |
| replacePrefixes ($query) | |
| Parse some common prefixes: all (search everything) or namespace names. | |
| searchText ($term) | |
| Perform a full text search query and return a result set. | |
| searchTitle ($term) | |
| Perform a title-only search query and return a result set. | |
| setFeatureData ($feature, $data) | |
| Way to pass custom data for engines. | |
| setLimitOffset ($limit, $offset=0) | |
| Set the maximum number of results to return and how many to skip before returning the first. | |
| setNamespaces ($namespaces) | |
| Set which namespaces the search should include. | |
| supports ($feature) | |
| transformSearchTerm ($term) | |
| Transform search term in cases when parts of the query came as different GET params (when supported) e.g. | |
| update ($id, $title, $text) | |
| Create or update the search index record for the given page. | |
| updateTitle ($id, $title) | |
| Update a search index record's title only. | |
Static Public Member Functions | |
| static | create () |
| Load up the appropriate search engine class for the currently active database backend, and return a configured instance. | |
| static | defaultNamespaces () |
| An array of namespaces indexes to be searched by default. | |
| static | getMWSuggestTemplate () |
| Get internal MediaWiki Suggest template. | |
| static | getNearMatch ($searchterm) |
| If an exact title match can be found, or a very slightly close match, return the title. | |
| static | getNearMatchResultSet ($searchterm) |
| Do a near match (see SearchEngine::getNearMatch) and wrap it into a SearchResultSet. | |
| static | getOpenSearchTemplate () |
| Get OpenSearch suggestion template. | |
| static | helpNamespaces () |
| Return the help namespaces to be shown on Special:Search. | |
| static | legalSearchChars () |
| static | namespacesAsText ($namespaces) |
| Get a list of namespace names useful for showing in tooltips and preferences. | |
| static | searchableNamespaces () |
| Make a list of searchable namespaces and their canonical names. | |
| static | userHighlightPrefs () |
| Find snippet highlight settings for all users. | |
| static | userNamespaces ($user) |
| Extract default namespaces to search from the given user's settings, returning a list of index numbers. | |
Public Attributes | |
| $limit = 10 | |
| $namespaces = array( NS_MAIN ) | |
| $offset = 0 | |
| $prefix = '' | |
| $searchTerms = array() | |
| $showRedirects = false | |
Protected Attributes | |
| $db | |
| $features = array() | |
| Feature values. | |
Static Private Member Functions | |
| static | getNearMatchInternal ($searchterm) |
| Really find the title match. | |
Contain a class for special pages.
Definition at line 17 of file SearchEngine.php.
| SearchEngine::__construct | ( | $ | db = null | ) |
Reimplemented in SearchOracle, SearchPostgres, SearchMySQL, SearchSqlite, SearchIBM_DB2, SearchMssql, and MockSearch.
Definition at line 33 of file SearchEngine.php.
References $db, and wfGetDB().

If this search backend can list/unlist redirects.
Definition at line 69 of file SearchEngine.php.
References supports(), and wfDeprecated().

| static SearchEngine::create | ( | ) | [static] |
Load up the appropriate search engine class for the currently active database backend, and return a configured instance.
Definition at line 433 of file SearchEngine.php.
References $dbr, $wgSearchType, and wfGetDB().
Referenced by SearchUpdate\doUpdate(), SpecialSearch\getSearchEngine(), and ApiQuerySearch\run().


| static SearchEngine::defaultNamespaces | ( | ) | [static] |
An array of namespaces indexes to be searched by default.
Definition at line 383 of file SearchEngine.php.
References $wgNamespacesToBeSearchedDefault.
Referenced by getOpenSearchTemplate(), SpecialSearch\getSearchProfiles(), and SpecialSearchTest\provideSearchOptionsTests().

| SearchEngine::filter | ( | $ | text | ) |
Return a 'cleaned up' search string.
| $text | String |
Definition at line 423 of file SearchEngine.php.
References legalSearchChars().
Referenced by SearchMySQL\searchInternal(), and SearchSqlite\searchInternal().


| static SearchEngine::getMWSuggestTemplate | ( | ) | [static] |
Get internal MediaWiki Suggest template.
Definition at line 495 of file SearchEngine.php.
References $wgMWSuggestTemplate, $wgServer, and wfScript().
Referenced by ResourceLoaderStartUpModule\getConfig().


| static SearchEngine::getNearMatch | ( | $ | searchterm | ) | [static] |
If an exact title match can be found, or a very slightly close match, return the title.
If no match, returns NULL.
| $searchterm | String |
Definition at line 130 of file SearchEngine.php.
References $title, getNearMatchInternal(), and wfRunHooks().
Referenced by getNearMatchInternal(), and SpecialSearch\goResult().


| static SearchEngine::getNearMatchInternal | ( | $ | searchterm | ) | [static, private] |
Really find the title match.
Definition at line 151 of file SearchEngine.php.
References $matches, $page, $title, $wgContLang, $wgEnableSearchContributorsByIP, WikiPage\factory(), getNearMatch(), SpecialPage\getTitleFor(), User\isIP(), Title\makeTitle(), Title\newFromText(), wfFindFile(), and wfRunHooks().
Referenced by getNearMatch().


| static SearchEngine::getNearMatchResultSet | ( | $ | searchterm | ) | [static] |
Do a near match (see SearchEngine::getNearMatch) and wrap it into a SearchResultSet.
| $searchterm | string |
Definition at line 144 of file SearchEngine.php.
Referenced by ApiQuerySearch\run().

| static SearchEngine::getOpenSearchTemplate | ( | ) | [static] |
Get OpenSearch suggestion template.
Definition at line 477 of file SearchEngine.php.
References $wgCanonicalServer, $wgOpenSearchTemplate, defaultNamespaces(), and wfScript().

| static SearchEngine::helpNamespaces | ( | ) | [static] |
Return the help namespaces to be shown on Special:Search.
Definition at line 411 of file SearchEngine.php.
References $wgNamespacesToBeSearchedHelp.
Referenced by SpecialSearch\getSearchProfiles().

| static SearchEngine::legalSearchChars | ( | ) | [static] |
Reimplemented in SearchOracle, SearchMySQL, and SearchSqlite.
Definition at line 259 of file SearchEngine.php.
Referenced by SearchUpdate\doUpdate(), filter(), Title\indexTitle(), SearchIBM_DB2\parseQuery(), and SearchMssql\parseQuery().

| static SearchEngine::namespacesAsText | ( | $ | namespaces | ) | [static] |
Get a list of namespace names useful for showing in tooltips and preferences.
| $namespaces | Array |
Definition at line 395 of file SearchEngine.php.
References $namespaces, $wgContLang, and wfMsg().
Referenced by SpecialSearch\getSearchProfiles().


| SearchEngine::normalizeText | ( | $ | string | ) |
When overridden in derived class, performs database-specific conversions on text to be used for searching or updating search index.
Default implementation does nothing (simply returns $string).
| $string | string: String to process |
Reimplemented in SearchMySQL.
Definition at line 108 of file SearchEngine.php.
References $wgContLang.
| SearchEngine::replacePrefixes | ( | $ | query | ) |
Parse some common prefixes: all (search everything) or namespace names.
| $query | String |
Definition at line 291 of file SearchEngine.php.
References $prefix, $wgContLang, wfMsgForContent(), and wfRunHooks().

| static SearchEngine::searchableNamespaces | ( | ) | [static] |
Make a list of searchable namespaces and their canonical names.
Definition at line 324 of file SearchEngine.php.
References $wgContLang, and wfRunHooks().
Referenced by User\getDefaultOptions(), SpecialSearch\getSearchProfiles(), Preferences\loadOldSearchNs(), SpecialSearch\powerSearch(), SpecialSearch\powerSearchBox(), and userNamespaces().


| SearchEngine::searchText | ( | $ | term | ) |
Perform a full text search query and return a result set.
If title searches are not supported or disabled, return null. STUB
| $term | String: raw search term |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchPostgres, SearchIBM_DB2, and SearchMssql.
Definition at line 49 of file SearchEngine.php.
| SearchEngine::searchTitle | ( | $ | term | ) |
Perform a title-only search query and return a result set.
If title searches are not supported or disabled, return null. STUB
| $term | String: raw search term |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchIBM_DB2, SearchMssql, and SearchPostgres.
Definition at line 61 of file SearchEngine.php.
| SearchEngine::setFeatureData | ( | $ | feature, |
| $ | data | ||
| ) |
Way to pass custom data for engines.
| $feature | String |
| $data | Mixed |
Definition at line 96 of file SearchEngine.php.
| SearchEngine::setLimitOffset | ( | $ | limit, |
| $ | offset = 0 |
||
| ) |
Set the maximum number of results to return and how many to skip before returning the first.
| $limit | Integer |
| $offset | Integer |
Definition at line 270 of file SearchEngine.php.
| SearchEngine::setNamespaces | ( | $ | namespaces | ) |
Set which namespaces the search should include.
Give an array of namespace index numbers.
| $namespaces | Array |
Definition at line 281 of file SearchEngine.php.
References $namespaces.
| SearchEngine::supports | ( | $ | feature | ) |
| $feature | String |
Reimplemented in SearchMySQL.
Definition at line 79 of file SearchEngine.php.
Referenced by acceptListRedirects().

| SearchEngine::transformSearchTerm | ( | $ | term | ) |
Transform search term in cases when parts of the query came as different GET params (when supported) e.g.
for prefix queries: search=test&prefix=Main_Page/Archive -> test prefix:Main Page/Archive
Definition at line 119 of file SearchEngine.php.
| SearchEngine::update | ( | $ | id, |
| $ | title, | ||
| $ | text | ||
| ) |
Create or update the search index record for the given page.
Title and text should be pre-processed. STUB
| $id | Integer |
| $title | String |
| $text | String |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchPostgres, SearchIBM_DB2, SearchMssql, and MockSearch.
Definition at line 456 of file SearchEngine.php.
| SearchEngine::updateTitle | ( | $ | id, |
| $ | title | ||
| ) |
Update a search index record's title only.
Title should be pre-processed. STUB
| $id | Integer |
| $title | String |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchIBM_DB2, SearchPostgres, and SearchMssql.
Definition at line 468 of file SearchEngine.php.
| static SearchEngine::userHighlightPrefs | ( | ) | [static] |
Find snippet highlight settings for all users.
Definition at line 372 of file SearchEngine.php.
Referenced by SearchResult\getTextSnippet().

| static SearchEngine::userNamespaces | ( | $ | user | ) | [static] |
Extract default namespaces to search from the given user's settings, returning a list of index numbers.
| $user | User |
Definition at line 344 of file SearchEngine.php.
References $user, $wgSearchEverythingOnlyLoggedIn, and searchableNamespaces().
Referenced by OutputPage\getJSVars(), and SpecialSearch\load().


SearchEngine::$db [protected] |
Reimplemented in SearchPostgres, and SearchSqlite.
Definition at line 31 of file SearchEngine.php.
Referenced by __construct(), SearchMssql\__construct(), SearchIBM_DB2\__construct(), SearchMySQL\__construct(), and SearchOracle\__construct().
SearchEngine::$features = array() [protected] |
Feature values.
Definition at line 26 of file SearchEngine.php.
| SearchEngine::$limit = 10 |
Definition at line 18 of file SearchEngine.php.
Referenced by setLimitOffset().
| SearchEngine::$namespaces = array( NS_MAIN ) |
Definition at line 22 of file SearchEngine.php.
Referenced by namespacesAsText(), SearchIBM_DB2\queryNamespaces(), SearchMssql\queryNamespaces(), SearchOracle\queryNamespaces(), SearchSqlite\queryNamespaces(), SearchPostgres\searchQuery(), and setNamespaces().
| SearchEngine::$offset = 0 |
Definition at line 19 of file SearchEngine.php.
Referenced by setLimitOffset().
| SearchEngine::$prefix = '' |
Definition at line 20 of file SearchEngine.php.
Referenced by replacePrefixes().
| SearchEngine::$searchTerms = array() |
Definition at line 21 of file SearchEngine.php.
| SearchEngine::$showRedirects = false |
Definition at line 23 of file SearchEngine.php.