Exemple #1
0
 /**
  * @param int $partnerId
  * @param int $objectType of enum IndexObjectType
  * @param baseObjectFilter $filter The filter should return the list of objects that need to be reindexed
  * @param bool $shouldUpdate Indicates that the object columns and attributes values should be recalculated before reindexed
  * @param array $featureStatusesToRemove - kFeatureStatus to remove when job is finished.
  * @return BatchJob
  */
 public static function addIndexJob($partnerId, $objectType, baseObjectFilter $filter, $shouldUpdate, $featureStatusesToRemove = array())
 {
     $jobData = new kIndexJobData();
     $jobData->setFilter($filter);
     $jobData->setShouldUpdate($shouldUpdate);
     $jobData->setFeatureStatusesToRemove($featureStatusesToRemove);
     $batchJob = new BatchJob();
     $batchJob->setPartnerId($partnerId);
     return self::addJob($batchJob, $jobData, BatchJobType::INDEX, $objectType);
 }
Exemple #2
0
 public static function handleIndexFailed(BatchJob $dbBatchJob, kIndexJobData $data)
 {
     $featureStatusesToRemove = $data->getFeatureStatusesToRemove();
     foreach ($featureStatusesToRemove as $featureStatusToRemove) {
         if (!$featureStatusToRemove instanceof kFeatureStatus) {
             continue;
         }
         $dbBatchJob->getPartner()->resetFeaturesStatusByType($featureStatusToRemove->getType());
     }
     return $dbBatchJob;
 }