本文整理汇总了PHP中Indexer::clearoutDeleted方法的典型用法代码示例。如果您正苦于以下问题:PHP Indexer::clearoutDeleted方法的具体用法?PHP Indexer::clearoutDeleted怎么用?PHP Indexer::clearoutDeleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Indexer
的用法示例。
在下文中一共展示了Indexer::clearoutDeleted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDocumentsQueue
/**
* Get the queue of documents for indexing
* Refactored from indexDocuments()
*/
public function getDocumentsQueue($max = null)
{
global $default;
// Cleanup the queue
Indexer::clearoutDeleted();
$date = date('Y-m-d H:i:s');
// identify the indexers that must run
// mysql specific limit!
$sql = "SELECT\n \t\t\tiff.document_id, mt.filetypes, mt.mimetypes, me.name as extractor, iff.what\n\t\t\t\tFROM\n\t\t\t\t\tindex_files iff\n\t\t\t\t\tINNER JOIN documents d ON iff.document_id=d.id\n\t\t\t\t\tINNER JOIN document_metadata_version dmv ON d.metadata_version_id=dmv.id\n\t\t\t\t\tINNER JOIN document_content_version dcv ON dmv.content_version_id=dcv.id\n\t\t\t\t\tINNER JOIN mime_types mt ON dcv.mime_id=mt.id\n\t\t\t\t\tLEFT JOIN mime_extractors me ON mt.extractor_id=me.id\n \t\t\t\tWHERE\n \t\t\t\t\t(iff.processdate IS NULL or iff.processdate < date_sub('{$date}', interval 1 day)) AND dmv.status_id=1\n\t\t\t\tORDER BY indexdate\n \t\t\t\t\tLIMIT {$max}";
$result = DBUtil::getResultArray($sql);
if (PEAR::isError($result)) {
//unlink($indexLockFile);
if ($this->debug) {
$default->log->error('indexDocuments: stopping - db error');
}
return;
}
KTUtil::setSystemSetting('luceneIndexingDate', time());
// bail if no work to do
if (count($result) == 0) {
//unlink($indexLockFile);
if ($this->debug) {
$default->log->debug('indexDocuments: stopping - no work to be done');
}
return;
}
// identify any documents that need indexing and mark them
// so they are not taken in a followup run
$ids = array();
foreach ($result as $docinfo) {
$ids[] = $docinfo['document_id'];
}
// mark the documents as being processed
$ids = implode(',', $ids);
$sql = "UPDATE index_files SET processdate='{$date}' WHERE document_id in ({$ids})";
DBUtil::runQuery($sql);
return $result;
}