...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/agent/search/entitysearchcontentrebuildagent.php
- Класс: Bitrix\Crm\Agent\Search\EntitySearchContentRebuildAgent
- Вызов: EntitySearchContentRebuildAgent::doRun
static function doRun() { $instance = static::getInstance(); if($instance === null) { return false; } if(!$instance->isEnabled()) { //Trace('Disabled', 'Y', 1); return false; } $progressData = $instance->getProgressData(); $offsetID = isset($progressData['LAST_ITEM_ID']) ? (int)($progressData['LAST_ITEM_ID']) : 0; $processedItemQty = isset($progressData['PROCESSED_ITEMS']) ? (int)($progressData['PROCESSED_ITEMS']) : 0; $totalItemQty = isset($progressData['TOTAL_ITEMS']) ? (int)($progressData['TOTAL_ITEMS']) : 0; if($totalItemQty <= 0) { $totalItemQty = $instance->getTotalCount(); } $limit = (int)Option::get('crm', '~CRM_SEARCH_CONTENT_STEP_LIMIT', self::ITEM_LIMIT); if($limit <= 0) { $instance->enable(false); //Trace('Canceled', $totalItemQty, 1); return false; } $itemIDs = $instance->prepareItemIDs($offsetID, $limit); $itemQty = count($itemIDs); if($itemQty === 0) { $instance->enable(false); //Trace('Completed', $totalItemQty, 1); return false; } $instance->rebuild($itemIDs); $processedItemQty += $itemQty; if($totalItemQty < $processedItemQty) { $totalItemQty = $instance->getTotalCount(); } $progressData['LAST_ITEM_ID'] = $itemIDs[$itemQty - 1]; $progressData['PROCESSED_ITEMS'] = $processedItemQty; $progressData['TOTAL_ITEMS'] = $totalItemQty; $instance->setProgressData($progressData); //Trace('Running', "{$processedItemQty} from {$totalItemQty}", 1); return true; }