SearchEngine Class Reference
[Search]

Contain a class for special pages. More...

Inherited by MockSearch, SearchEngineDummy, SearchIBM_DB2, SearchMySQL, SearchOracle, SearchPostgres, and SearchSqlite.

List of all members.

Public Member Functions

 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.
 acceptListRedirects ()
 If this search backend can list/unlist redirects.
 normalizeText ($string)
 When overridden in derived class, performs database-specific conversions on text to be used for searching or updating search index.
 transformSearchTerm ($term)
 Transform search term in cases when parts of the query came as different GET params (when supported) e.g.
 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.
 replacePrefixes ($query)
 Parse some common prefixes: all (search everything) or namespace names.
 filter ($text)
 Return a 'cleaned up' search string.
 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 getNearMatch ($searchterm)
 If an exact title match can be found, or a very slightly close match, return the title.
static legalSearchChars ()
static searchableNamespaces ()
 Make a list of searchable namespaces and their canonical names.
static userNamespaces ($user)
 Extract default namespaces to search from the given user's settings, returning a list of index numbers.
static userHighlightPrefs (&$user)
 Find snippet highlight settings for a given user.
static defaultNamespaces ()
 An array of namespaces indexes to be searched by default.
static namespacesAsText ($namespaces)
 Get a list of namespace names useful for showing in tooltips and preferences.
static helpNamespaces ()
 Return the help namespaces to be shown on Special:Search.
static create ()
 Load up the appropriate search engine class for the currently active database backend, and return a configured instance.
static getOpenSearchTemplate ()
 Get OpenSearch suggestion template.
static getMWSuggestTemplate ()
 Get internal MediaWiki Suggest template.

Public Attributes

 $limit = 10
 $offset = 0
 $prefix = ''
 $searchTerms = array()
 $namespaces = array( NS_MAIN )
 $showRedirects = false

Static Private Member Functions

static getNearMatchInternal ($searchterm)
 Really find the title match.


Detailed Description

Contain a class for special pages.

Definition at line 13 of file SearchEngine.php.


Member Function Documentation

SearchEngine::acceptListRedirects (  ) 

If this search backend can list/unlist redirects.

Definition at line 46 of file SearchEngine.php.

static SearchEngine::create (  )  [static]

Load up the appropriate search engine class for the currently active database backend, and return a configured instance.

Returns:
SearchEngine

Definition at line 365 of file SearchEngine.php.

References $dbr, $wgSearchType, and wfGetDB().

Referenced by SearchUpdate::doUpdate(), ApiQuerySearch::run(), and SpecialSearch::showResults().

static SearchEngine::defaultNamespaces (  )  [static]

An array of namespaces indexes to be searched by default.

Returns:
Array

Definition at line 315 of file SearchEngine.php.

References $wgNamespacesToBeSearchedDefault.

Referenced by getOpenSearchTemplate(), and SpecialSearch::getSearchProfiles().

SearchEngine::filter ( text  ) 

Return a 'cleaned up' search string.

Parameters:
$text String
Returns:
String

Definition at line 355 of file SearchEngine.php.

References legalSearchChars().

Referenced by SearchSqlite::searchInternal(), and SearchMySQL::searchInternal().

static SearchEngine::getMWSuggestTemplate (  )  [static]

Get internal MediaWiki Suggest template.

Returns:
String

Definition at line 424 of file SearchEngine.php.

References $wgMWSuggestTemplate, $wgScriptPath, and $wgServer.

Referenced by Skin::makeGlobalVariablesScript().

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.

Parameters:
$searchterm String
Returns:
Title

Definition at line 77 of file SearchEngine.php.

References $title, getNearMatchInternal(), and wfRunHooks().

Referenced by getNearMatchInternal(), and SpecialSearch::goResult().

static SearchEngine::getNearMatchInternal ( searchterm  )  [static, private]

static SearchEngine::getOpenSearchTemplate (  )  [static]

Get OpenSearch suggestion template.

Returns:
String

Definition at line 408 of file SearchEngine.php.

References $wgOpenSearchTemplate, $wgScriptPath, $wgServer, and defaultNamespaces().

static SearchEngine::helpNamespaces (  )  [static]

Return the help namespaces to be shown on Special:Search.

Returns:
Array

Definition at line 343 of file SearchEngine.php.

References $wgNamespacesToBeSearchedHelp.

Referenced by SpecialSearch::getSearchProfiles().

static SearchEngine::legalSearchChars (  )  [static]

static SearchEngine::namespacesAsText ( namespaces  )  [static]

Get a list of namespace names useful for showing in tooltips and preferences.

Parameters:
$namespaces Array

Definition at line 327 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).

Parameters:
$string string: String to process
Returns:
string

Reimplemented in SearchMySQL.

Definition at line 58 of file SearchEngine.php.

SearchEngine::replacePrefixes ( query  ) 

Parse some common prefixes: all (search everything) or namespace names.

Parameters:
$query String

Definition at line 222 of file SearchEngine.php.

References $prefix, $wgContLang, wfMsgForContent(), and wfRunHooks().

static SearchEngine::searchableNamespaces (  )  [static]

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

Parameters:
$term String: raw search term
Returns:
SearchResultSet

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, SearchPostgres, and SearchSqlite.

Definition at line 29 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

Parameters:
$term String: raw search term
Returns:
SearchResultSet

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, SearchPostgres, and SearchSqlite.

Definition at line 41 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.

Parameters:
$limit Integer
$offset Integer

Definition at line 201 of file SearchEngine.php.

References $limit, and $offset.

SearchEngine::setNamespaces ( namespaces  ) 

Set which namespaces the search should include.

Give an array of namespace index numbers.

Parameters:
$namespaces Array

Definition at line 212 of file SearchEngine.php.

References $namespaces.

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 66 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

Parameters:
$id Integer
$title String
$text String

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, SearchPostgres, SearchSqlite, and MockSearch.

Definition at line 387 of file SearchEngine.php.

SearchEngine::updateTitle ( id,
title 
)

Update a search index record's title only.

Title should be pre-processed. STUB

Parameters:
$id Integer
$title String

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, SearchPostgres, and SearchSqlite.

Definition at line 399 of file SearchEngine.php.

static SearchEngine::userHighlightPrefs ( &$  user  )  [static]

Find snippet highlight settings for a given user.

Parameters:
$user User
Returns:
Array contextlines, contextchars

Definition at line 302 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.

Parameters:
$user User
Returns:
Array

Definition at line 275 of file SearchEngine.php.

References $wgSearchEverythingOnlyLoggedIn, Preferences::loadOldSearchNs(), and searchableNamespaces().

Referenced by SpecialSearch::__construct(), and Skin::makeGlobalVariablesScript().


Member Data Documentation

SearchEngine::$limit = 10

Definition at line 14 of file SearchEngine.php.

Referenced by setLimitOffset().

SearchEngine::$namespaces = array( NS_MAIN )

SearchEngine::$offset = 0

Definition at line 15 of file SearchEngine.php.

Referenced by setLimitOffset().

SearchEngine::$prefix = ''

Definition at line 16 of file SearchEngine.php.

Referenced by replacePrefixes(), and SearchPostgres::searchQuery().

SearchEngine::$searchTerms = array()

Definition at line 17 of file SearchEngine.php.

SearchEngine::$showRedirects = false

Definition at line 19 of file SearchEngine.php.


The documentation for this class was generated from the following file:

Generated on Sat Apr 30 22:57:48 2011 for MediaWiki by  doxygen 1.5.9