本文整理匯總了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());
}