MediaWiki  REL1_23
PrefixSearch Class Reference

Handles searching prefixes of titles and finding any page names that match. More...

Inheritance diagram for PrefixSearch:

List of all members.

Public Member Functions

 search ($search, $limit, $namespaces=array())
 Do a prefix search of titles and return a list of matching page names.
 searchWithVariants ($search, $limit, array $namespaces)
 Do a prefix search for all possible variants of the prefix.

Static Public Member Functions

static titleSearch ($search, $limit, $namespaces=array())
 Do a prefix search of titles and return a list of matching page names.

Protected Member Functions

 defaultSearchBackend ($namespaces, $search, $limit)
 Unless overridden by PrefixSearchBackend hook...
 searchBackend ($namespaces, $search, $limit)
 Do a prefix search of titles and return a list of matching page names.
 specialSearch ($search, $limit)
 Prefix search special-case for Special: namespace.
 strings (array $strings)
 When implemented in a descendant class, receives an array of titles as strings and returns either an unmodified array or an array of Title objects corresponding to strings received.
 titles (array $titles)
 When implemented in a descendant class, receives an array of Title objects and returns either an unmodified array or an array of strings corresponding to titles passed to it.
 validateNamespaces ($namespaces)
 Validate an array of numerical namespace indexes.

Detailed Description

Handles searching prefixes of titles and finding any page names that match.

Used largely by the OpenSearch implementation.

Definition at line 29 of file PrefixSearch.php.


Member Function Documentation

PrefixSearch::defaultSearchBackend ( namespaces,
search,
limit 
) [protected]

Unless overridden by PrefixSearchBackend hook...

This is case-sensitive (First character may be automatically capitalized by Title::secureAndSpit() later on depending on $wgCapitalLinks)

Parameters:
array$namespacesnamespaces to search in
string$searchterm
$limitInteger: max number of items to return
Returns:
Array of Title objects

Definition at line 221 of file PrefixSearch.php.

References $dbr, $limit, $namespaces, $res, $t, array(), as, Title\newFromRow(), Title\newFromText(), and wfGetDB().

Referenced by searchBackend().

PrefixSearch::search ( search,
limit,
namespaces = array() 
)

Do a prefix search of titles and return a list of matching page names.

Parameters:
$searchString
$limitInteger
array$namespacesused if query is not explicitly prefixed
Returns:
Array of strings or Title objects

Definition at line 52 of file PrefixSearch.php.

References $limit, $namespaces, $title, array(), Title\newFromText(), searchBackend(), and validateNamespaces().

Referenced by searchWithVariants(), and titleSearch().

PrefixSearch::searchBackend ( namespaces,
search,
limit 
) [protected]

Do a prefix search of titles and return a list of matching page names.

Parameters:
$namespacesArray
$searchString
$limitInteger
Returns:
Array of strings

Definition at line 143 of file PrefixSearch.php.

References $limit, $namespaces, array(), defaultSearchBackend(), specialSearch(), strings(), titles(), and wfRunHooks().

Referenced by search().

PrefixSearch::searchWithVariants ( search,
limit,
array namespaces 
)

Do a prefix search for all possible variants of the prefix.

Parameters:
$searchString
$limitInteger
array$namespaces
Returns:
array

Definition at line 91 of file PrefixSearch.php.

References $limit, $wgContLang, array(), as, global, search(), wfProfileIn(), and wfProfileOut().

Referenced by ApiOpenSearch\execute().

PrefixSearch::specialSearch ( search,
limit 
) [protected]

Prefix search special-case for Special: namespace.

Parameters:
string$searchterm
$limitInteger: max number of items to return
Returns:
Array

Definition at line 166 of file PrefixSearch.php.

References $keys, $limit, $wgContLang, array(), as, bug, SpecialPageFactory\getList(), global, and Title\makeTitleSafe().

Referenced by searchBackend().

PrefixSearch::strings ( array strings) [abstract, protected]

When implemented in a descendant class, receives an array of titles as strings and returns either an unmodified array or an array of Title objects corresponding to strings received.

Parameters:
array$strings
Returns:
array

Reimplemented in StringPrefixSearch, and TitlePrefixSearch.

Referenced by searchBackend().

PrefixSearch::titles ( array titles) [abstract, protected]

When implemented in a descendant class, receives an array of Title objects and returns either an unmodified array or an array of strings corresponding to titles passed to it.

Parameters:
array$titles
Returns:
array

Reimplemented in StringPrefixSearch, and TitlePrefixSearch.

Referenced by searchBackend().

static PrefixSearch::titleSearch ( search,
limit,
namespaces = array() 
) [static]

Do a prefix search of titles and return a list of matching page names.

Deprecated:
: Since 1.23, use TitlePrefixSearch or StringPrefixSearch classes
Parameters:
$searchString
$limitInteger
array$namespacesused if query is not explicitly prefixed
Returns:
Array of strings

Definition at line 39 of file PrefixSearch.php.

References $limit, $namespaces, and search().

PrefixSearch::validateNamespaces ( namespaces) [protected]

Validate an array of numerical namespace indexes.

Parameters:
$namespacesArray
Returns:
Array (default: contains only NS_MAIN)

Definition at line 252 of file PrefixSearch.php.

References $namespaces, $wgContLang, array(), as, and global.

Referenced by search().


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