36 $this->
insertPage(
'Redirect test',
'#REDIRECT [[Redirect Test]]' );
38 $this->
insertPage(
'Redirect Test Worse Result' );
39 $this->
insertPage(
'Redirect test2',
'#REDIRECT [[Redirect Test2]]' );
40 $this->
insertPage(
'Redirect TEST2',
'#REDIRECT [[Redirect Test2]]' );
42 $this->
insertPage(
'Redirect Test2 Worse Result' );
62 'wgSpecialPages' => [],
66 $this->search = MediaWikiServices::getInstance()->newSearchEngine();
67 $this->search->setNamespaces( [] );
69 $this->originalHandlers = TestingAccessWrapper::newFromClass( Hooks::class )->handlers;
70 TestingAccessWrapper::newFromClass( Hooks::class )->handlers = [];
82 if ( $results ===
null ) {
86 'PrefixSearchBackend' => [
104 'Main namespace with title prefix',
117 'Talk namespace prefix',
125 'User namespace prefix',
132 'Special namespace prefix',
133 'query' =>
'Special:',
135 'Special:ActiveUsers',
136 'Special:AllMessages',
137 'Special:AllMyUploads',
145 'Special namespace with prefix',
146 'query' =>
'Special:Un',
149 'Special:UncategorizedCategories',
150 'Special:UncategorizedFiles',
154 'Special:UncategorizedPages',
159 'query' =>
'Special:EditWatchlist',
161 'Special:EditWatchlist',
165 'Special page subpages',
166 'query' =>
'Special:EditWatchlist/',
168 'Special:EditWatchlist/clear',
169 'Special:EditWatchlist/raw',
173 'Special page subpages with prefix',
174 'query' =>
'Special:EditWatchlist/cl',
176 'Special:EditWatchlist/clear',
187 $this->search->setLimitOffset( 3 );
188 $results = $this->search->defaultPrefixSearch( $case[
'query'] );
190 return $t->getPrefixedText();
205 $this->search->setLimitOffset( 3, 1 );
206 $results = $this->search->defaultPrefixSearch( $case[
'query'] );
208 return $t->getPrefixedText();
214 $expected =
isset( $case[
'offsetresult'] ) ?
215 array_merge( $case[
'results'], $case[
'offsetresult'] ) :
242 'Exact match not in first result should be moved to the first result (T72958)',
256 'Exact match missing from results should be added as first result (T72958)',
270 'Exact match missing and not existing pages should be dropped',
282 "Exact match shouldn't override already found match if " .
283 "exact is redirect and found isn't",
286 'Redirect Test Worse Result',
289 'query' =>
'redirect test',
293 'Redirect Test Worse Result',
297 "Exact match shouldn't override already found match if " .
298 "both exact match and found match are redirect",
302 'Redirect Test2 Worse Result',
305 'query' =>
'redirect TEST2',
310 'Redirect Test2 Worse Result',
314 "Exact match should override any already found matches that " .
315 "are redirects to it",
319 'Redirect Test Worse Result',
322 'query' =>
'Redirect Test',
327 'Redirect Test Worse Result',
332 "Extra results must not be returned",
358 return $s->getText();
369 $res = [
'Example',
'Example Bar',
'Example Foo',
'Example Foo/Bar' ];
371 'With less than requested results no pagination' => [
374 'With same as requested results no pagination' => [
377 'With extra result returned offer pagination' => [
391 $this->
assertEquals( $hasMoreResults, $results->hasMoreResults() );
396 ->setMethods( [
'completionSearchBackend' ] )->getMock();
401 ->method(
'completionSearchBackend' )
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
mockSearchWithResults( $titleStrings, $limit=3)
testSearchBackend(array $case)
provideSearchBackend PrefixSearch::searchBackend
testSearchWithOffset(array $case)
provideSearch SearchEngine::defaultPrefixSearch
static provideSearchBackend()
testSearch(array $case)
provideSearch SearchEngine::defaultPrefixSearch
searchProvision(array $results=null)
testPagination( $hasMoreResults, $provision)
paginationProvider SearchSuggestionSet::hasMoreResults
Contain a class for special pages.
completionSearch( $search)
Perform a completion search.
setLimitOffset( $limit, $offset=0)
Set the maximum number of results to return and how many to skip before returning the first.
static fromStrings(array $titles, $hasMoreResults=false)
Builds a new set of suggestion based on a string array.
Represents a title within MediaWiki.
namespace and then decline to actually register it & $namespaces
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))