本文整理汇总了PHP中search::update_record方法的典型用法代码示例。如果您正苦于以下问题:PHP search::update_record方法的具体用法?PHP search::update_record怎么用?PHP search::update_record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::update_record方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_index
static function update_index($task)
{
$completed = $task->get("completed", 0);
foreach (ORM::factory("search_record")->where("dirty", 1)->limit(2)->find_all() as $record) {
search::update_record($record);
$completed++;
}
$task->set("completed", $completed);
list($remaining, $total, $percent) = self::_get_stats();
$task->percent_complete = round(100 * $completed / ($remaining + $completed));
$task->status = t("%done records records updated, index is %percent% up-to-date", array("done" => $completed, "percent" => $percent));
if ($remaining == 0) {
$task->done = true;
$task->state = "success";
site_status::clear("search_index_out_of_date");
}
}
示例2: install
static function install()
{
$version = module::get_version("search");
$db = Database::instance();
if ($version == 0) {
$db->query("CREATE TABLE `search_records` (\n `id` int(9) NOT NULL auto_increment,\n `item_id` int(9),\n `dirty` boolean default 1,\n `data` LONGTEXT default NULL,\n PRIMARY KEY (`id`),\n FULLTEXT INDEX (`data`))\n ENGINE=MyISAM DEFAULT CHARSET=utf8;");
// populate the index with dirty records
$db->query("insert into `search_records` (`item_id`) SELECT `id` FROM `items`");
module::set_version("search", 1);
if (ORM::factory("search_record")->count_all() < 10) {
foreach (ORM::factory("search_record")->where("dirty", 1)->find_all() as $record) {
search::update_record($record);
}
} else {
search::check_index();
}
}
}
示例3: item_related_update
static function item_related_update($item)
{
$record = ORM::factory("search_record")->where("item_id", $item->id)->find();
search::update_record($record);
}