MediaWiki
1.33.0
|
Handles searching prefixes of titles and finding any page names that match. More...
Public Member Functions | |
defaultSearchBackend ( $namespaces, $search, $limit, $offset) | |
Unless overridden by PrefixSearchBackend hook... More... | |
search ( $search, $limit, $namespaces=[], $offset=0) | |
Do a prefix search of titles and return a list of matching page names. More... | |
searchWithVariants ( $search, $limit, array $namespaces, $offset=0) | |
Do a prefix search for all possible variants of the prefix. More... | |
Static Public Member Functions | |
static | titleSearch ( $search, $limit, $namespaces=[], $offset=0) |
Do a prefix search of titles and return a list of matching page names. More... | |
Protected Member Functions | |
searchBackend ( $namespaces, $search, $limit, $offset) | |
Do a prefix search of titles and return a list of matching page names. More... | |
specialSearch ( $search, $limit, $offset) | |
Prefix search special-case for Special: namespace. More... | |
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. More... | |
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. More... | |
validateNamespaces ( $namespaces) | |
Validate an array of numerical namespace indexes. More... | |
Private Member Functions | |
handleResultFromHook ( $srchres, $namespaces, $search, $limit, $offset) | |
Handles searching prefixes of titles and finding any page names that match.
Used largely by the OpenSearch implementation.
Definition at line 32 of file PrefixSearch.php.
PrefixSearch::defaultSearchBackend | ( | $namespaces, | |
$search, | |||
$limit, | |||
$offset | |||
) |
Unless overridden by PrefixSearchBackend hook...
This is case-sensitive (First character may be automatically capitalized by Title::secureAndSpit() later on depending on $wgCapitalLinks)
array | null | $namespaces | Namespaces to search in |
string | $search | Term |
int | $limit | Max number of items to return |
int | $offset | Number of items to skip |
Definition at line 254 of file PrefixSearch.php.
References $dbr, $namespaces, $options, $res, $title, as, DB_REPLICA, LIST_AND, LIST_OR, Title\makeTitleSafe(), TitleArray\newFromResult(), NS_MAIN, NS_SPECIAL, specialSearch(), and wfGetDB().
Referenced by searchBackend(), and SearchEngine\simplePrefixSearch().
|
private |
Definition at line 150 of file PrefixSearch.php.
References $namespaces.
Referenced by searchBackend().
PrefixSearch::search | ( | $search, | |
$limit, | |||
$namespaces = [] , |
|||
$offset = 0 |
|||
) |
Do a prefix search of titles and return a list of matching page names.
string | $search | |
int | $limit | |
array | $namespaces | Used if query is not explicitly prefixed |
int | $offset | How many results to offset from the beginning |
Definition at line 57 of file PrefixSearch.php.
References $namespaces, list, SearchEngine\parseNamespacePrefixes(), and searchBackend().
Referenced by searchWithVariants(), PrefixSearchTest\testSearch(), PrefixSearchTest\testSearchBackend(), PrefixSearchTest\testSearchWithOffset(), and titleSearch().
|
protected |
Do a prefix search of titles and return a list of matching page names.
array | $namespaces | |
string | $search | |
int | $limit | |
int | $offset | How many results to offset from the beginning |
Definition at line 130 of file PrefixSearch.php.
References $namespaces, captcha-old\count, defaultSearchBackend(), handleResultFromHook(), NS_FILE, NS_MEDIA, NS_SPECIAL, Hooks\run(), specialSearch(), strings(), and titles().
Referenced by search().
PrefixSearch::searchWithVariants | ( | $search, | |
$limit, | |||
array | $namespaces, | ||
$offset = 0 |
|||
) |
Do a prefix search for all possible variants of the prefix.
string | $search | |
int | $limit | |
array | $namespaces | |
int | $offset | How many results to offset from the beginning |
Definition at line 80 of file PrefixSearch.php.
References $namespaces, as, captcha-old\count, and search().
|
protected |
Prefix search special-case for Special: namespace.
string | $search | Term |
int | $limit | Max number of items to return |
int | $offset | Number of items to offset |
Definition at line 170 of file PrefixSearch.php.
References $keys, $matches, as, captcha-old\count, Title\makeTitleSafe(), NS_SPECIAL, and use.
Referenced by defaultSearchBackend(), and searchBackend().
|
abstractprotected |
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.
array | $strings |
Reimplemented in StringPrefixSearch, and TitlePrefixSearch.
Referenced by searchBackend().
|
abstractprotected |
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.
array | $titles |
Reimplemented in StringPrefixSearch, and TitlePrefixSearch.
Referenced by searchBackend().
|
static |
Do a prefix search of titles and return a list of matching page names.
string | $search | |
int | $limit | |
array | $namespaces | Used if query is not explicitly prefixed |
int | $offset | How many results to offset from the beginning |
Definition at line 43 of file PrefixSearch.php.
References $namespaces, and search().
|
protected |
Validate an array of numerical namespace indexes.
array | $namespaces |
Definition at line 310 of file PrefixSearch.php.
References $namespaces, as, captcha-old\count, and NS_MAIN.