MediaWiki REL1_28
|
An utility class to rescore search results by looking for an exact match in the db and add the page found to the first position. More...
Public Member Functions | |
rescore ( $search, $namespaces, $srchres, $limit) | |
Default search backend does proper prefix searching, but custom backends may sort based on other algorithms that may cause the exact title match to not be in the results or be lower down the list. | |
Private Member Functions | |
getRedirectTarget ( $title) | |
Get a redirect's destination from a title. | |
pullFront ( $key, $array) | |
Returns an array where the element of $array at index $key becomes the first element. | |
redirectTargetsToRedirect ( $titles) | |
An utility class to rescore search results by looking for an exact match in the db and add the page found to the first position.
NOTE: extracted from TitlePrefixSearch
Definition at line 31 of file SearchExactMatchRescorer.php.
|
private |
Get a redirect's destination from a title.
Title | $title | A title to redirect. It may not redirect or even exist |
Definition at line 136 of file SearchExactMatchRescorer.php.
References $page, $title, and WikiPage\factory().
Referenced by redirectTargetsToRedirect(), and rescore().
|
private |
Returns an array where the element of $array at index $key becomes the first element.
int | $key | key to pull to the front |
Definition at line 125 of file SearchExactMatchRescorer.php.
Referenced by rescore().
|
private |
string[] | $titles | as strings |
Definition at line 103 of file SearchExactMatchRescorer.php.
References $title, $titles, as, and getRedirectTarget().
Referenced by rescore().
SearchExactMatchRescorer::rescore | ( | $search, | |
$namespaces, | |||
$srchres, | |||
$limit | |||
) |
Default search backend does proper prefix searching, but custom backends may sort based on other algorithms that may cause the exact title match to not be in the results or be lower down the list.
string | $search | the query |
int[] | $namespaces | the namespaces |
int | $limit | the max number of results to return |
string[] | $srchres | results |
Definition at line 42 of file SearchExactMatchRescorer.php.
References $limit, $namespaces, $t, getRedirectTarget(), NS_MAIN, pullFront(), and redirectTargetsToRedirect().