function panelIndexAction() { $tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'"); if ($rowAsset) { $this->view->valueText = $rowAsset->valueText; } else { $this->view->valueText = 'None'; } }
function indexingCatalogAction() { $guid = $this->_getParam('guid') ? $this->_getParam('guid') : ''; $catalogGuid = $this->_getParam('catalogGuid') ? $this->_getParam('catalogGuid') : ''; $solrAdapter = Pandamp_Search::manager(); try { $solrAdapter->indexCatalog($catalogGuid); $tblTmpIndex = new Pandamp_Modules_Extension_Index_Model_TmpIndex(); $tblTmpIndex->delete("guid='{$guid}'"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $username = '******' . $auth->getIdentity()->username; } else { $username = '******'; } // log to assetSetting $tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'"); if ($rowAsset) { $rowAsset->valueText = "Update indexing-catalog at " . date("d-m-Y H:i:s") . $username; $rowAsset->valueInt = $rowAsset->valueInt + 1; } else { $gman = new Pandamp_Core_Guid(); $catalogGuid = $gman->generateGuid(); $rowAsset = $tblAssetSetting->fetchNew(); $rowAsset->guid = $catalogGuid; $rowAsset->application = "INDEX CATALOG"; $rowAsset->part = "KUTU"; $rowAsset->valueType = "INDEX"; $rowAsset->valueInt = 0; $rowAsset->valueText = "Indexing catalog at " . date("d-m-Y H:i:s") . $username; } $rowAsset->save(); $this->view->success = true; } catch (Exception $e) { $this->view->success = false; } }
public function reIndexCatalog() { gc_enable(); $this->emptyIndex(); $time_start = microtime(true); $solr =& $this->_solr; $formater = new Pandamp_Lib_Formater(); $title = new Pandamp_Controller_Action_Helper_GetCatalogTitle(); // $tbl = new Pandamp_Core_Orm_Table_Catalog(); // $rowset = $tbl->fetchAll(); //("profileGuid='Pandamp_peraturan'"); $query = "SELECT * FROM KutuCatalog"; $results = $this->_conn->query($query); $rowset = $results->fetchAll(PDO::FETCH_OBJ); $documents = array(); $rowCount = count($rowset); for ($iCount = 0; $iCount < $rowCount; $iCount++) { $row = $rowset[$iCount]; // if($iCount == 100) // break; // echo 'urutan: '.$iCount .'<br>'; $nextRow = $rowset[$iCount + 1]; // echo 'current guid: '.$row->guid.' '.'next guid: '.$nextRow->guid.'<br>'; if ($row->modifiedBy !== $row->createdBy) { $modified = '<font color=red>[modifiedBy:<i>' . $row->modifiedBy . '</i>]</font> '; } else { $modified = ''; } echo '<li><span style="font:11px verdana,arial,helvetica,sans-serif;">[urutan:' . $iCount . '] indexing:<font color=green>' . $title->getCatalogTitle($row->guid) . '</font>[current guid: ' . $row->guid . ' ' . 'next guid: ' . $nextRow->guid . '][author:<i>' . $row->createdBy . '</i>] ' . $modified . '[createdDate:<i>' . $formater->get_date($row->createdDate) . '</i>]</span></li>'; $documents[] = $this->_createSolrDocument($row); if ($iCount % 500 == 0) { try { $solr->addDocuments($documents); $solr->commit(); // $solr->optimize(); $documents = array(); } catch (Exception $e) { // echo "Error occured when processing record starting from number: ". ($iCount - 1000) . ' to '.$iCount.' '.$row->guid; $log->err($e->getMessage()); throw new Zend_Exception($e->getMessage()); // echo $e->getMessage().'<br>'; } } flush(); } echo '</ul></div></td></tr></table>'; try { $solr->addDocuments($documents); $solr->commit(); // $solr->optimize(); } catch (Exception $e) { $log->err($e->getMessage()); throw new Zend_Exception($e->getMessage()); // echo $e->getMessage().'<br>'; } $time_end = microtime(true); $time = $time_end - $time_start; // echo'<br>WAKTU EKSEKUSI: '. $time; // $log->info("WAKTU EKSEKUSI: ". $time." indexing catalog ".$iCount." dari ".$rowCount ." ".$username); echo '<br><br><span style="font:11px verdana,arial,helvetica,sans-serif;color:#00FF00">WAKTU EKSEKUSI: ' . $time . '<br>indexing catalog ' . $iCount . ' dari ' . $rowCount . '</span>'; // log to assetSetting $tblAssetSetting = new Pandamp_Modules_Dms_Catalog_Model_AssetSetting(); $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'"); if ($rowAsset) { $rowAsset->valueText = "Update {$rowCount} indexing-catalog at " . date("Y-m-d H:i:s") . $username; $rowAsset->valueInt = $rowAsset->valueInt + 1; } else { $gman = new Pandamp_Core_Guid(); $catalogGuid = $gman->generateGuid(); $rowAsset = $tblAssetSetting->fetchNew(); $rowAsset->guid = $catalogGuid; $rowAsset->application = "INDEX CATALOG"; $rowAsset->part = "KUTU"; $rowAsset->valueType = "INDEX"; $rowAsset->valueInt = 0; $rowAsset->valueText = $rowCount . " Indexing catalog at " . date("Y-m-d H:i:s") . $username; } $rowAsset->save(); }