本文整理汇总了PHP中eZSolr::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSolr::commit方法的具体用法?PHP eZSolr::commit怎么用?PHP eZSolr::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSolr
的用法示例。
在下文中一共展示了eZSolr::commit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
$limit = 10;
$continue = false;
$cli->output($row['path']);
do
{
$cmd = "{$php} extension/ezfind/bin/php/updatesearchindexsolr.php -s site_admin --topNodeID=${row['node_id']} --limit={$limit} --offset={$offset} 2>/dev/null";
$cli->output("\t".$offset);
exec( $cmd, $out );
$lastLine = array_pop($out);
if ( trim($lastLine) == $limit )
{
$continue = true;
$offset += $limit;
}
else
{
$continue = false;
}
}
while ($continue);
}
$solr = new eZSolr();
$solr->commit();
$script->shutdown(0);
示例2: indexnode
private function indexnode($nodeId)
{
$engine = new eZSolr();
$node = eZContentObjectTreeNode::fetch($nodeId);
$object = eZContentObject::fetch($node->attribute('contentobject_id'));
if ($object) {
$result = $engine->addObject($object, false);
$engine->commit();
}
}
示例3: catch
if ($object) {
if ($needRemoveWithUpdate) {
$searchEngine->removeObject($object, false);
}
$removeFromPendingActions = $searchEngine->addObject($object, false);
}
if ($removeFromPendingActions) {
$db->query("DELETE FROM ezpending_actions WHERE action = 'index_object' AND param = '{$objectID}'");
} else {
$cli->warning("\tFailed indexing object ID #{$objectID}, keeping it in the queue.");
// Increase the offset to skip failing objects
++$offset;
}
$db->commit();
}
$searchEngine->commit();
// clear object cache to conserve memory
eZContentObject::clearCache();
} else {
break;
// No valid result from ezpending_actions
}
}
$cli->output("Done");
$script->shutdown();
} catch (Exception $e) {
$errCode = $e->getCode();
$errCode = $errCode != 0 ? $errCode : 1;
// If an error has occured, script must terminate with a status other than 0
$script->shutdown($errCode, $e->getMessage());
}