MediaWiki REL1_41
SearchApi.php File Reference

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. More...

Go to the source code of this file.

Functions

 buildCommonApiParams ( $isScrollable=true)
 The set of api parameters that are shared between api calls that call the SearchEngine.
 
 buildSearchEngine (array $params=null)
 Build the search engine to use.
 
 getContext ()
 
 getSearchProfileParams ()
 

Variables

trait SearchApi
 Traits for API components that use a SearchEngine.
 

Detailed Description

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Since
1.28

Definition in file SearchApi.php.

Function Documentation

◆ buildCommonApiParams()

buildCommonApiParams ( $isScrollable = true)

The set of api parameters that are shared between api calls that call the SearchEngine.

Primarily this defines parameters that are utilized by self::buildSearchEngine().

Parameters
bool$isScrollableTrue if the api offers scrolling
Returns
array

Definition at line 64 of file SearchApi.php.

References NS_MAIN.

Referenced by ApiOpenSearch\getAllowedParams(), ApiQueryPrefixSearch\getAllowedParams(), and ApiQuerySearch\getAllowedParams().

◆ buildSearchEngine()

buildSearchEngine ( array $params = null)

Build the search engine to use.

If $params is provided then the following searchEngine options will be set:

  • backend: which search backend to use
  • limit: mandatory
  • offset: optional
  • namespace: mandatory
  • search engine profiles defined by SearchApi::getSearchProfileParams()
    Parameters
    array | null$paramsAPI request params (must be sanitized by ApiBase::extractRequestParams() before)
    Returns
    SearchEngine

Definition at line 174 of file SearchApi.php.

References getSearchProfileParams().

◆ getContext()

getContext ( )
abstract
Returns
IContextSource

Referenced by UploadForm\__construct(), WatchAction\__construct(), Article\addHelpLink(), MediaWiki\Output\OutputPage\addSubtitle(), Article\adjustDisplayTitle(), Skin\buildNavUrls(), ContextSource\canUseWikiPage(), DerivativeContext\canUseWikiPage(), MediaWiki\Actions\FileDeleteAction\checkCanExecute(), CategoryPage\closeShowCategory(), ImagePage\doRenderLangOpt(), ApiHelp\execute(), ApiOptions\execute(), ApiParse\execute(), ApiMain\executeAction(), ApiMain\executeActionWithErrorHandling(), ContextSource\exportSession(), ChangesList\formatCharacterDifference(), MediaWiki\SpecialPage\PageQueryPage\formatResult(), MediaWiki\Pager\ContribsPager\formatRow(), DifferenceEngine\generateContentDiffBody(), DifferenceEngine\generateTextDiffBody(), DerivativeContext\getActionName(), MediaWiki\SpecialPage\LoginSignupSpecialPage\getAuthForm(), MediaWiki\Specials\SpecialEditWatchlist\getClearForm(), ContextSource\getConfig(), DerivativeContext\getConfig(), MediaWiki\SpecialPage\SpecialPage\getConfig(), HistoryAction\getDescription(), FormatMetadata\getExtendedMetadataFromHook(), MediaWiki\Specials\SpecialRecentChanges\getExtraOptions(), ApiBase\getFinalDescription(), ApiBase\getFinalParamDescription(), ApiBase\getFinalSummary(), MediaWiki\Pager\ImageListPager\getForm(), MediaWiki\Specials\SpecialContributions\getForm(), WatchAction\getFormFields(), MediaWiki\SpecialPage\SpecialPage\getFullTitle(), MediaWiki\Output\OutputPage\getJSVars(), Action\getLanguage(), ContextSource\getLanguage(), DerivativeContext\getLanguage(), MediaWiki\SpecialPage\SpecialPage\getLanguage(), EditWatchlistNormalHTMLForm\getLegend(), MediaWiki\Specials\SpecialEditWatchlist\getNormalForm(), Article\getOldIDFromRequest(), Action\getOutput(), ContextSource\getOutput(), DerivativeContext\getOutput(), MediaWiki\SpecialPage\SpecialPage\getOutput(), Article\getParserOptions(), ApiOptions\getPreferences(), MediaWiki\Specials\SpecialEditWatchlist\getRawForm(), RawAction\getRawText(), Action\getRequest(), ContextSource\getRequest(), DerivativeContext\getRequest(), MediaWiki\SpecialPage\SpecialPage\getRequest(), Article\getRobotPolicy(), Action\getSkin(), ContextSource\getSkin(), DerivativeContext\getSkin(), MediaWiki\SpecialPage\SpecialPage\getSkin(), DifferenceEngine\getSlotDiffRenderers(), Skin\getTemplateData(), DifferenceEngine\getTextDiffer(), ImagePage\getThumbPrevText(), ImagePage\getThumbSizes(), ContextSource\getTiming(), DerivativeContext\getTiming(), ContextSource\getTitle(), DerivativeContext\getTitle(), HTMLForm\getTitle(), Skin\getUndeleteLink(), Action\getUser(), ContextSource\getUser(), DerivativeContext\getUser(), MediaWiki\SpecialPage\SpecialPage\getUser(), MediaWiki\Specials\SpecialEditWatchlist\getWatchlistInfo(), ContextSource\getWikiPage(), DerivativeContext\getWikiPage(), RollbackAction\handleRollbackRequest(), MediaWiki\Output\OutputPage\headElement(), ImagePage\imageDupes(), ImagePage\imageHistory(), ImagePage\imageLinks(), ChangesList\insertLog(), ChangesList\insertLogEntry(), Article\isDiffOnlyView(), Article\isFileCacheable(), LogEventsList\logLine(), MediaWiki\SpecialPage\ChangesListSpecialPage\makeLegend(), Skin\makeLink(), Skin\makeListItem(), ImagePage\makeMetadataTable(), Action\msg(), ContextSource\msg(), MediaWiki\SpecialPage\SpecialPage\msg(), McrUndoAction\onSubmit(), WatchAction\onSuccess(), HistoryAction\onView(), InfoAction\onView(), ImagePage\openShowImage(), MediaWiki\Specials\SpecialRecentChanges\outputChangesList(), InfoAction\pageInfo(), MediaWiki\Output\OutputPage\parseAsContent(), MediaWiki\Output\OutputPage\parseAsInterface(), MediaWiki\Output\OutputPage\parserOptions(), ImagePage\printSharedImageText(), ChangesList\recentChangesFlags(), Article\render(), DifferenceEngine\renderNewRevision(), ApiOptions\resetPreferences(), MediaWiki\Output\OutputPage\setHTMLTitle(), Article\setOldSubtitle(), MediaWiki\Output\OutputPage\setPageTitle(), MediaWiki\Output\OutputPage\setTitle(), McrUndoAction\show(), Article\showDeletedRevisionHeader(), DifferenceEngine\showDiffPage(), Article\showDiffPage(), ImagePage\showError(), Article\showMissingArticle(), Article\showNamespaceHeader(), LogEventsList\showOptions(), Article\showPatrolFooter(), Article\showRedirectedFromHeader(), MediaWiki\EditPage\EditPage\showStandardInputs(), ImagePage\showTOC(), Article\showViewFooter(), SkinTemplate\tabAction(), DeleteAction\tempDelete(), Article\tryFileCache(), ImagePage\uploadLinksBox(), Article\view(), CategoryPage\view(), ImagePage\view(), and Skin\wrapHTML().

◆ getSearchProfileParams()

getSearchProfileParams ( )
abstract
Returns
array[] array of arrays mapping from parameter name to a two value map containing 'help-message' and 'profile-type' keys.

Referenced by buildSearchEngine().