MediaWiki
REL1_24
|
Contain a class for special pages. More...
Public Member Functions | |
delete ($id, $title) | |
Delete an indexed page Title should be pre-processed. | |
getTextFromContent (Title $t, Content $c=null) | |
Get the raw text for updating the index from a content object Nicer search backends could possibly do something cooler than just returning raw text. | |
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. | |
setShowSuggestion ($showSuggestion) | |
Set whether the searcher should try to build a suggestion. | |
supports ($feature) | |
textAlreadyUpdatedForIndex () | |
If an implementation of SearchEngine handles all of its own text processing in getTextFromContent() and doesn't require SearchUpdate::updateText()'s rather silly handling, it should return true here instead. | |
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 ($type=null) |
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 | 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 | getSearchTypes () |
Return the search engines we support. | |
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 | |
int[] | $namespaces = array( NS_MAIN ) |
* | |
string | $prefix = '' |
* | |
Protected Attributes | |
array | $features = array() |
Feature values *. | |
int | $limit = 10 |
* | |
int | $offset = 0 |
* | |
array string | $searchTerms = array() |
* | |
bool | $showSuggestion = true |
* | |
Static Private Member Functions | |
static | getNearMatchInternal ($searchterm) |
Really find the title match. |
Contain a class for special pages.
Definition at line 32 of file SearchEngine.php.
static SearchEngine::create | ( | $ | type = null | ) | [static] |
Load up the appropriate search engine class for the currently active database backend, and return a configured instance.
string | $type | Type of search backend, if not the default |
Definition at line 422 of file SearchEngine.php.
Referenced by SearchResult\initText(), and ApiQuerySearch\run().
static SearchEngine::defaultNamespaces | ( | ) | [static] |
An array of namespaces indexes to be searched by default.
Definition at line 390 of file SearchEngine.php.
Referenced by SpecialSearchTest\provideSearchOptionsTests().
SearchEngine::delete | ( | $ | id, |
$ | title | ||
) |
Delete an indexed page Title should be pre-processed.
STUB
Reimplemented in SearchMySQL.
Definition at line 489 of file SearchEngine.php.
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.
string | $searchterm |
Definition at line 130 of file SearchEngine.php.
Referenced by legalSearchChars().
static SearchEngine::getNearMatchInternal | ( | $ | searchterm | ) | [static, private] |
Really find the title match.
string | $searchterm |
Definition at line 153 of file SearchEngine.php.
static SearchEngine::getNearMatchResultSet | ( | $ | searchterm | ) | [static] |
Do a near match (see SearchEngine::getNearMatch) and wrap it into a SearchResultSet.
string | $searchterm |
Definition at line 144 of file SearchEngine.php.
Referenced by ApiQuerySearch\run().
static SearchEngine::getOpenSearchTemplate | ( | ) | [static] |
static SearchEngine::getSearchTypes | ( | ) | [static] |
Return the search engines we support.
If only $wgSearchType is set, it'll be an array of just that one item.
Definition at line 447 of file SearchEngine.php.
References array(), and global.
Referenced by ApiQuerySearch\getAllowedParams(), and ApiQuerySearch\getParamDescription().
SearchEngine::getTextFromContent | ( | Title $ | t, |
Content $ | c = null |
||
) |
Get the raw text for updating the index from a content object Nicer search backends could possibly do something cooler than just returning raw text.
Definition at line 524 of file SearchEngine.php.
static SearchEngine::legalSearchChars | ( | ) | [static] |
Reimplemented in SearchOracle, SearchMySQL, and SearchSqlite.
Definition at line 268 of file SearchEngine.php.
References $matches, and getNearMatch().
Referenced by SearchMssql\parseQuery().
static SearchEngine::namespacesAsText | ( | $ | namespaces | ) | [static] |
Get a list of namespace names useful for showing in tooltips and preferences.
array | $namespaces |
Definition at line 403 of file SearchEngine.php.
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 105 of file SearchEngine.php.
SearchEngine::replacePrefixes | ( | $ | query | ) |
Parse some common prefixes: all (search everything) or namespace names.
string | $query |
Definition at line 312 of file SearchEngine.php.
static SearchEngine::searchableNamespaces | ( | ) | [static] |
Make a list of searchable namespaces and their canonical names.
Definition at line 343 of file SearchEngine.php.
Referenced by SpecialSearch\powerSearch(), and SpecialSearch\powerSearchBox().
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
string | $term | Raw search term |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchPostgres, and SearchMssql.
Definition at line 55 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
string | $term | Raw search term |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchMssql, and SearchPostgres.
Definition at line 67 of file SearchEngine.php.
SearchEngine::setFeatureData | ( | $ | feature, |
$ | data | ||
) |
Way to pass custom data for engines.
string | $feature | |
mixed | $data |
Definition at line 93 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.
int | $limit | |
int | $offset |
Definition at line 279 of file SearchEngine.php.
SearchEngine::setNamespaces | ( | $ | namespaces | ) |
Set which namespaces the search should include.
Give an array of namespace index numbers.
array | $namespaces |
Definition at line 290 of file SearchEngine.php.
References $namespaces, and namespaces.
SearchEngine::setShowSuggestion | ( | $ | showSuggestion | ) |
Set whether the searcher should try to build a suggestion.
Note: some searchers don't support building a suggestion in the first place and others don't respect this flag.
bool | $showSuggestion | Should the searcher try to build suggestions |
Definition at line 301 of file SearchEngine.php.
SearchEngine::supports | ( | $ | feature | ) |
string | $feature |
Reimplemented in SearchMySQL.
Definition at line 76 of file SearchEngine.php.
If an implementation of SearchEngine handles all of its own text processing in getTextFromContent() and doesn't require SearchUpdate::updateText()'s rather silly handling, it should return true here instead.
Definition at line 535 of file SearchEngine.php.
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
string | $term |
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
int | $id | |
string | $title | |
string | $text |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchPostgres, SearchMssql, and MockSearch.
Definition at line 465 of file SearchEngine.php.
SearchEngine::updateTitle | ( | $ | id, |
$ | title | ||
) |
Update a search index record's title only.
Title should be pre-processed. STUB
int | $id | |
string | $title |
Reimplemented in SearchMySQL, SearchSqlite, SearchOracle, SearchMssql, and SearchPostgres.
Definition at line 477 of file SearchEngine.php.
static SearchEngine::userHighlightPrefs | ( | ) | [static] |
Find snippet highlight settings for all users.
Definition at line 379 of file SearchEngine.php.
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 363 of file SearchEngine.php.
Feature values *.
Definition at line 45 of file SearchEngine.php.
int SearchEngine::$limit = 10 [protected] |
*
Definition at line 37 of file SearchEngine.php.
int [] SearchEngine::$namespaces = array( NS_MAIN ) |
*
Definition at line 35 of file SearchEngine.php.
Referenced by SearchMssql\queryNamespaces(), SearchOracle\queryNamespaces(), SearchSqlite\queryNamespaces(), SearchPostgres\searchQuery(), and setNamespaces().
int SearchEngine::$offset = 0 [protected] |
*
Definition at line 39 of file SearchEngine.php.
string SearchEngine::$prefix = '' |
*
Definition at line 33 of file SearchEngine.php.
*
Definition at line 41 of file SearchEngine.php.
bool SearchEngine::$showSuggestion = true [protected] |
*
Definition at line 43 of file SearchEngine.php.