SearchEngine Class Reference
[Search]

Contain a class for special pages. More...

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

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.
 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 find, 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 projectNamespaces ()
 An array of "project" namespaces indexes typically searched by logged-in users.
static defaultAndProjectNamespaces ()
 An array of "project" namespaces indexes typically searched by logged-in users in addition to the default namespaces.
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


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 48 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 345 of file SearchEngine.php.

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

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

static SearchEngine::defaultAndProjectNamespaces (  )  [static]

An array of "project" namespaces indexes typically searched by logged-in users in addition to the default namespaces.

Returns:
array

Definition at line 322 of file SearchEngine.php.

References $wgNamespacesToBeSearchedDefault, and $wgNamespacesToBeSearchedProject.

static SearchEngine::defaultNamespaces (  )  [static]

An array of namespaces indexes to be searched by default.

Returns:
array

Definition at line 279 of file SearchEngine.php.

References $wgNamespacesToBeSearchedDefault.

Referenced by SpecialSearch::formHeader(), getOpenSearchTemplate(), and SpecialSearch::setupPage().

SearchEngine::filter ( text  ) 

Return a 'cleaned up' search string.

Returns:
string
Access:
public

Definition at line 335 of file SearchEngine.php.

References $text, and legalSearchChars().

static SearchEngine::getMWSuggestTemplate (  )  [static]

Get internal MediaWiki Suggest template.

Returns:
string

Definition at line 406 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 find, or a very slightly close match, return the title.

If no match, returns NULL.

Parameters:
string $term
Returns:
Title

Definition at line 67 of file SearchEngine.php.

References $title, $wgContLang, MediaWiki::articleFromTitle(), SpecialPage::getTitleFor(), User::isIP(), Title::makeTitle(), Title::newFromText(), wfFindFile(), and wfRunHooks().

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

static SearchEngine::getOpenSearchTemplate (  )  [static]

Get OpenSearch suggestion template.

Returns:
string

Definition at line 389 of file SearchEngine.php.

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

static SearchEngine::legalSearchChars (  )  [static]

static SearchEngine::namespacesAsText ( namespaces  )  [static]

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

Parameters:
unknown_type $namespaces

Definition at line 291 of file SearchEngine.php.

References $key, $namespaces, $ns, $wgContLang, and wfMsg().

Referenced by SpecialSearch::formHeader().

static SearchEngine::projectNamespaces (  )  [static]

An array of "project" namespaces indexes typically searched by logged-in users.

Returns:
array

Definition at line 309 of file SearchEngine.php.

References $wgNamespacesToBeSearchedDefault, and $wgNamespacesToBeSearchedProject.

Referenced by SpecialSearch::formHeader(), and SpecialSearch::setupPage().

SearchEngine::replacePrefixes ( query  ) 

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

Parameters:
string $query

Definition at line 200 of file SearchEngine.php.

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

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.

Parameters:
string $term - Raw search term
Returns:
SearchResultSet
Access:
public

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, and SearchPostgres.

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

Parameters:
string $term - Raw search term
Returns:
SearchResultSet
Access:
public

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, and SearchPostgres.

Definition at line 43 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:
int $limit
int $offset
Access:
public

Definition at line 178 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:
array $namespaces
Access:
public

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

Parameters:
int $id
string $title
string $text

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, and SearchPostgres.

Definition at line 367 of file SearchEngine.php.

SearchEngine::updateTitle ( id,
title 
)

Update a search index record's title only.

Title should be pre-processed.

Parameters:
int $id
string $title

Reimplemented in SearchIBM_DB2, SearchMySQL, SearchOracle, and SearchPostgres.

Definition at line 379 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 265 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 248 of file SearchEngine.php.

References $name, $ns, $user, and searchableNamespaces().

Referenced by SpecialSearchOld::__construct(), 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 Sep 5 02:08:46 2009 for MediaWiki by  doxygen 1.5.9