本文整理汇总了PHP中SearchEngine::getSearchTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchEngine::getSearchTypes方法的具体用法?PHP SearchEngine::getSearchTypes怎么用?PHP SearchEngine::getSearchTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchEngine
的用法示例。
在下文中一共展示了SearchEngine::getSearchTypes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doUpdate
/**
* Perform actual update for the entry
*/
public function doUpdate()
{
global $wgDisableSearchUpdate;
if ($wgDisableSearchUpdate || !$this->id) {
return;
}
wfProfileIn(__METHOD__);
$page = WikiPage::newFromId($this->id, WikiPage::READ_LATEST);
$indexTitle = Title::indexTitle($this->title->getNamespace(), $this->title->getText());
foreach (SearchEngine::getSearchTypes() as $type) {
$search = SearchEngine::create($type);
if (!$search->supports('search-update')) {
continue;
}
$normalTitle = $search->normalizeText($indexTitle);
if ($page === null) {
$search->delete($this->id, $normalTitle);
continue;
} elseif ($this->content === false) {
$search->updateTitle($this->id, $normalTitle);
continue;
}
$text = $search->getTextFromContent($this->title, $this->content);
if (!$search->textAlreadyUpdatedForIndex()) {
$text = self::updateText($text);
}
# Perform the actual update
$search->update($this->id, $normalTitle, $search->normalizeText($text));
}
wfProfileOut(__METHOD__);
}
示例2: doUpdate
/**
* Perform actual update for the entry
*/
public function doUpdate()
{
global $wgDisableSearchUpdate;
if ($wgDisableSearchUpdate || !$this->id) {
return;
}
foreach (SearchEngine::getSearchTypes() as $type) {
$search = SearchEngine::create($type);
if (!$search->supports('search-update')) {
continue;
}
$normalTitle = $this->getNormalizedTitle($search);
if ($this->getLatestPage() === null) {
$search->delete($this->id, $normalTitle);
continue;
} elseif ($this->content === false) {
$search->updateTitle($this->id, $normalTitle);
continue;
}
$text = $search->getTextFromContent($this->title, $this->content);
if (!$search->textAlreadyUpdatedForIndex()) {
$text = self::updateText($text);
}
# Perform the actual update
$search->update($this->id, $normalTitle, $search->normalizeText($text));
}
}
示例3: getAllowedParams
public function getAllowedParams()
{
$params = array('search' => array(ApiBase::PARAM_TYPE => 'string', ApiBase::PARAM_REQUIRED => true), 'namespace' => array(ApiBase::PARAM_DFLT => NS_MAIN, ApiBase::PARAM_TYPE => 'namespace', ApiBase::PARAM_ISMULTI => true), 'what' => array(ApiBase::PARAM_DFLT => null, ApiBase::PARAM_TYPE => array('title', 'text', 'nearmatch')), 'info' => array(ApiBase::PARAM_DFLT => 'totalhits|suggestion|rewrittenquery', ApiBase::PARAM_TYPE => array('totalhits', 'suggestion', 'rewrittenquery'), ApiBase::PARAM_ISMULTI => true), 'prop' => array(ApiBase::PARAM_DFLT => 'size|wordcount|timestamp|snippet', ApiBase::PARAM_TYPE => array('size', 'wordcount', 'timestamp', 'snippet', 'titlesnippet', 'redirecttitle', 'redirectsnippet', 'sectiontitle', 'sectionsnippet', 'isfilematch', 'categorysnippet', 'score', 'hasrelated'), ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_HELP_MSG_PER_VALUE => array()), 'offset' => array(ApiBase::PARAM_DFLT => 0, ApiBase::PARAM_HELP_MSG => 'api-help-param-continue'), 'limit' => array(ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_SML1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_SML2), 'interwiki' => false, 'enablerewrites' => false);
$alternatives = SearchEngine::getSearchTypes();
if (count($alternatives) > 1) {
if ($alternatives[0] === null) {
$alternatives[0] = self::BACKEND_NULL_PARAM;
}
$params['backend'] = array(ApiBase::PARAM_DFLT => $this->getConfig()->get('SearchType'), ApiBase::PARAM_TYPE => $alternatives);
}
return $params;
}
示例4: getParamDescription
public function getParamDescription()
{
$descriptions = array('search' => 'Search for all page titles (or content) that has this value', 'namespace' => 'The namespace(s) to enumerate', 'what' => 'Search inside the text or titles', 'info' => 'What metadata to return', 'prop' => array('What properties to return', ' size - Adds the size of the page in bytes', ' wordcount - Adds the word count of the page', ' timestamp - Adds the timestamp of when the page was last edited', ' score - DEPRECATED and IGNORED', ' snippet - Adds a parsed snippet of the page', ' titlesnippet - Adds a parsed snippet of the page title', ' redirectsnippet - Adds a parsed snippet of the redirect title', ' redirecttitle - Adds the title of the matching redirect', ' sectionsnippet - Adds a parsed snippet of the matching section title', ' sectiontitle - Adds the title of the matching section', ' hasrelated - DEPRECATED and IGNORED'), 'offset' => 'Use this value to continue paging (return by query)', 'limit' => 'How many total pages to return', 'interwiki' => 'Include interwiki results in the search, if available');
if (count(SearchEngine::getSearchTypes()) > 1) {
$descriptions['backend'] = 'Which search backend to use, if not the default';
}
return $descriptions;
}
示例5: readData
/**
* @see Page::readData()
*/
public function readData()
{
parent::readData();
if (!count($_POST)) {
// set current date
$this->untilDay = intval(DateUtil::formatDate('%d', null, false, true));
$this->untilMonth = intval(DateUtil::formatDate('%m', null, false, true));
$this->untilYear = intval(DateUtil::formatDate('%Y', null, false, true));
}
$this->availableTypes = SearchEngine::getSearchTypes();
}