本文整理匯總了PHP中Updater::setSearchResults方法的典型用法代碼示例。如果您正苦於以下問題:PHP Updater::setSearchResults方法的具體用法?PHP Updater::setSearchResults怎麽用?PHP Updater::setSearchResults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Updater
的用法示例。
在下文中一共展示了Updater::setSearchResults方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
public function create($statsType)
{
// prepare things unique to this statsType
$ucStatsType = ucfirst($statsType);
if (!isset($this->updateIfOlderThan[$ucStatsType])) {
throw new Exception("unknown type of article stats type given: '{$statsType}'");
exit;
}
$viewName = $this->viewNameBase . strtolower($statsType);
$articleStatsClassName = $ucStatsType . "_ArticleStats";
// get search results for statsTypes that need them
$searchResults = $this->runSearch($ucStatsType);
// setup the objects we need
$db = new Db('https://' . AM_CRAWLER_USER . ':' . AM_CRAWLER_PW . '@' . AM_CRAWLER_DB_URL, AM_CRAWLER_DB_NAME);
$urls = new Urls();
$getter = new UrlGetter();
$articleStats = new $articleStatsClassName($getter, $urls);
$updater = new Updater($db, $this->log);
// setup update options
$updater->setViewName(array("crawl", $viewName));
$updater->setArticleStats($articleStats);
$updater->setSecondsBetweenUpdates($this->secondsBetweenDocUpdates[$ucStatsType]);
$updater->setUpdateIfOlderThan($this->updateIfOlderThan[$ucStatsType]);
$updater->setSearchResults($searchResults);
return $updater;
}