Esempio n. 1
0
 /**
  * Update application records in Solr that are stored in APP_SOLR_QUEUE table
  */
 public function synchronizePendingApplications()
 {
     // check table of pending updates
     $oAppSolrQueue = new AppSolrQueue();
     $aAppSolrQueue = $oAppSolrQueue->getListUpdatedApplications();
     foreach ($aAppSolrQueue as $oAppSolrQueueEntity) {
         // call the syncronization function
         if ($oAppSolrQueueEntity->appUpdated == 1) {
             $this->updateApplicationSearchIndex($oAppSolrQueueEntity->appUid);
         }
         if ($oAppSolrQueueEntity->appUpdated == 2) {
             $this->deleteApplicationSearchIndex($oAppSolrQueueEntity->appUid);
         }
         $this->applicationChangedUpdateSolrQueue($oAppSolrQueueEntity->appUid, 0);
     }
 }
Esempio n. 2
0
 /**
  * Update application records in Solr that are stored in APP_SOLR_QUEUE table
  */
 public function synchronizePendingApplications()
 {
     if (!$this->isSolrEnabled()) {
         throw new Exception(date('Y-m-d H:i:s:u') . " Error connecting to solr server.");
     }
     // check table of pending updates
     $oAppSolrQueue = new AppSolrQueue();
     $aAppSolrQueue = $oAppSolrQueue->getListUpdatedApplications();
     $trunkSize = 100;
     //filter updated cases
     $aUpdatedApplications = array();
     $aDeletedApplications = array();
     foreach ($aAppSolrQueue as $oAppSolrQueueEntity) {
         // call the syncronization function
         if ($oAppSolrQueueEntity->appUpdated == 1) {
             $aUpdatedApplications[] = array('APP_UID' => $oAppSolrQueueEntity->appUid);
         }
         if ($oAppSolrQueueEntity->appUpdated == 2) {
             $aDeletedApplications[] = array('APP_UID' => $oAppSolrQueueEntity->appUid);
         }
     }
     $totalCasesUpdated = count($aUpdatedApplications);
     $loops = $totalCasesUpdated % $trunkSize > 0 ? $totalCasesUpdated / $trunkSize + 1 : $totalCasesUpdated / $trunkSize;
     for ($i = 0; $i < $loops; $i++) {
         //prepare trunk of appuids
         $trunkUpdatedApplications = array_slice($aUpdatedApplications, $i * $trunkSize, $trunkSize);
         $this->updateApplicationSearchIndex($trunkUpdatedApplications, true);
         /*foreach($trunkUpdatedApplications as $appUid){
             $this->applicationChangedUpdateSolrQueue ($appUid, 0);  
           }*/
     }
     $totalCasesDeleted = count($aDeletedApplications);
     $loops = $totalCasesDeleted % $trunkSize > 0 ? $totalCasesDeleted / $trunkSize + 1 : $totalCasesDeleted / $trunkSize;
     for ($i = 0; $i < $loops; $i++) {
         //prepare trunk of appuids
         $trunkDeleteddApplications = array_slice($aDeletedApplications, $i * $trunkSize, $trunkSize);
         $this->deleteApplicationSearchIndex($trunkDeleteddApplications, true);
         /*foreach($trunkDeleteddApplications as $appUid){
             $this->applicationChangedUpdateSolrQueue ($appUid, 0);  
           }*/
     }
     /*
         foreach ($aAppSolrQueue as $oAppSolrQueueEntity) {
           // call the syncronization function
           if($oAppSolrQueueEntity->appUpdated == 1){
             $this->updateApplicationSearchIndex ($oAppSolrQueueEntity->appUid, false);
           }
           if($oAppSolrQueueEntity->appUpdated == 2){
             $this->deleteApplicationSearchIndex ($oAppSolrQueueEntity->appUid, false);
           }      
           $this->applicationChangedUpdateSolrQueue ($oAppSolrQueueEntity->appUid, 0);
         }*/
 }