Go to the documentation of this file.
57 foreach ( $suggestions
as $suggestion ) {
58 $pageID = $suggestion->getSuggestedTitleID();
59 if ( $pageID && empty( $this->pageMap[$pageID] ) ) {
60 $this->pageMap[$pageID] =
true;
62 $this->suggestions[] = $suggestion;
86 public function map( $callback ) {
87 return array_map( $callback, $this->suggestions );
96 public function filter( $callback ) {
97 $before =
count( $this->suggestions );
98 $this->suggestions = array_values( array_filter( $this->suggestions, $callback ) );
99 return $before -
count( $this->suggestions );
111 if ( $pageID && isset( $this->pageMap[$pageID] ) ) {
117 $this->suggestions[] = $suggestion;
119 $this->pageMap[$pageID] =
true;
138 $removed = array_splice( $this->suggestions, $key, 1 );
139 unset( $this->pageMap[$removed[0]->getSuggestedTitleID()] );
150 if ( $pageID && isset( $this->pageMap[$pageID] ) ) {
156 array_unshift( $this->suggestions, $suggestion );
158 $this->pageMap[$pageID] =
true;
166 if ( empty( $this->suggestions ) ) {
169 return $this->suggestions[0]->getScore();
176 if ( empty( $this->suggestions ) ) {
179 return end( $this->suggestions )->getScore();
186 return count( $this->suggestions );
194 if (
count( $this->suggestions ) > $limit ) {
195 $this->suggestions = array_slice( $this->suggestions, 0, $limit );
static fromStrings(array $titles, $hasMoreResults=false)
Builds a new set of suggestion based on a string array.
map( $callback)
Call array_map on the suggestions array.
bool $hasMoreResults
Are more results available?
setScore( $score)
Set the suggestion score.
prepend(SearchSuggestion $suggestion)
Add a new suggestion at the top.
__construct(array $suggestions, $hasMoreResults=false)
Builds a new set of suggestions.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static fromTitle( $score, Title $title)
Create suggestion from Title.
static fromTitles(array $titles, $hasMoreResults=false)
Builds a new set of suggestion based on a title array.
getSuggestions()
Get the list of suggestions.
namespace and then decline to actually register it file or subcat img or subcat $title
linkcache txt The LinkCache class maintains a list of article titles and the information about whether or not the article exists in the database This is used to mark up links when displaying a page If the same link appears more than once on any page then it only has to be looked up once In most cases link lookups are done in batches with the LinkBatch class or the equivalent in so the link cache is mostly useful for short snippets of parsed and for links in the navigation areas of the skin The link cache was formerly used to track links used in a document for the purposes of updating the link tables This application is now deprecated To create a you can use the following $titles
getSuggestedTitleID()
Title ID in the case this suggestion is based on a title.
appendAll(SearchSuggestionSet $set)
Add suggestion set to the end of the current one.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
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))
filter( $callback)
Filter the suggestions array.
shrink( $limit)
Remove any extra elements in the suggestions set.
rescore( $key)
Move the suggestion at index $key to the first position.
static emptySuggestionSet()
append(SearchSuggestion $suggestion)
Add a new suggestion at the end.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static fromText( $score, $text)
Create suggestion from text Will also create a title if text if not empty.
getScore()
Suggestion score.
SearchSuggestion[] $suggestions