Commit f274b6dbb245eb7d250033c8ecd9d2a6a7f1d335
1 parent
58e94cc5
KTS-4288 Called the update function directly instead of checking system_settings
"Indexer Statistics page doesn't get updated" Fixed. Committed by: Megan Watson
Showing
3 changed files
with
25 additions
and
20 deletions
plugins/search2/reporting/IndexingStatus.php
| ... | ... | @@ -89,12 +89,8 @@ class IndexingStatusDispatcher extends KTAdminDispatcher |
| 89 | 89 | // --------------------------- |
| 90 | 90 | |
| 91 | 91 | // Do a run time check for extractors not working |
| 92 | - Indexer::updateIndexStats(); | |
| 93 | - | |
| 94 | - // Get Results | |
| 95 | - $extractorDiagnosis = KTUtil::getSystemSetting('extractorDiagnostics'); | |
| 96 | - | |
| 97 | - if (!empty($extractorDiagnosis)) $extractorDiagnosis = unserialize($extractorDiagnosis); | |
| 92 | + $indexer = Indexer::get(); | |
| 93 | + $extractorDiagnosis = $indexer->diagnoseExtractors(); | |
| 98 | 94 | |
| 99 | 95 | // Create an Array to store errors |
| 100 | 96 | $this->extractorErrors = array(); | ... | ... |
plugins/search2/reporting/LuceneStatistics.php
| ... | ... | @@ -38,6 +38,7 @@ |
| 38 | 38 | |
| 39 | 39 | require_once(KT_LIB_DIR . '/dispatcher.inc.php'); |
| 40 | 40 | require_once(KT_LIB_DIR . '/templating/templating.inc.php'); |
| 41 | +require_once(KT_DIR . '/search2/indexing/indexerCore.inc.php'); | |
| 41 | 42 | |
| 42 | 43 | class LuceneStatisticsDispatcher extends KTAdminDispatcher |
| 43 | 44 | { |
| ... | ... | @@ -46,19 +47,18 @@ class LuceneStatisticsDispatcher extends KTAdminDispatcher |
| 46 | 47 | */ |
| 47 | 48 | function do_main() { |
| 48 | 49 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Indexer Statistics')); |
| 49 | - | |
| 50 | - $stats = KTUtil::getSystemSetting('indexerStats'); | |
| 51 | - | |
| 52 | - $this->stats = unserialize($stats); | |
| 50 | + | |
| 51 | + $indexer = Indexer::get(); | |
| 52 | + $stats = $indexer->getIndexStatistics(); | |
| 53 | 53 | |
| 54 | 54 | $oTemplating =& KTTemplating::getSingleton(); |
| 55 | 55 | $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_statistics'); |
| 56 | - | |
| 56 | + | |
| 57 | 57 | $aTemplateData = array( |
| 58 | 58 | 'context' => $this, |
| 59 | - 'stats'=>$this->stats | |
| 59 | + 'stats' => $stats | |
| 60 | 60 | ); |
| 61 | - | |
| 61 | + | |
| 62 | 62 | return $oTemplate->render($aTemplateData); |
| 63 | 63 | } |
| 64 | 64 | } | ... | ... |
search2/indexing/indexerCore.inc.php
| ... | ... | @@ -410,7 +410,7 @@ class FolderShortcutResultItem extends ProxyResultItem |
| 410 | 410 | var $parentId; |
| 411 | 411 | var $linkedId; |
| 412 | 412 | var $full_path; |
| 413 | - | |
| 413 | + | |
| 414 | 414 | public function getFolderID() { return $this->getId(); } |
| 415 | 415 | public function getMimeIconPath() { return 'folder_shortcut'; } |
| 416 | 416 | |
| ... | ... | @@ -759,6 +759,11 @@ abstract class Indexer |
| 759 | 759 | { |
| 760 | 760 | $content = file_get_contents($filename); |
| 761 | 761 | |
| 762 | + // if the file is empty something went wrong with the text extraction | |
| 763 | + if(empty($content)){ | |
| 764 | + return false; | |
| 765 | + } | |
| 766 | + | |
| 762 | 767 | $src = array("([\r\n])","([\n][\n])","([\n])","([\t])",'([ ][ ])'); |
| 763 | 768 | $tgt = array("\n","\n",' ',' ',' '); |
| 764 | 769 | |
| ... | ... | @@ -1057,7 +1062,7 @@ abstract class Indexer |
| 1057 | 1062 | return Indexer::getIndexingQueue(false); |
| 1058 | 1063 | } |
| 1059 | 1064 | |
| 1060 | - public function updateIndexStats() | |
| 1065 | + public function getIndexStatistics() | |
| 1061 | 1066 | { |
| 1062 | 1067 | $optimisationDate = KTUtil::getSystemSetting('luceneOptimisationDate', ''); |
| 1063 | 1068 | |
| ... | ... | @@ -1139,14 +1144,18 @@ abstract class Indexer |
| 1139 | 1144 | 'noOptimisation'=>$noOptimisation |
| 1140 | 1145 | ); |
| 1141 | 1146 | |
| 1142 | - KTUtil::setSystemSetting('indexerStats', serialize($stats)); | |
| 1147 | + return $stats; | |
| 1148 | + } | |
| 1143 | 1149 | |
| 1144 | - $indexer = Indexer::get(); | |
| 1150 | + public function updateIndexStats() | |
| 1151 | + { | |
| 1152 | + $stats = $this->getIndexStatistics(); | |
| 1153 | + KTUtil::setSystemSetting('indexerStats', serialize($stats)); | |
| 1145 | 1154 | |
| 1146 | - $diagnosis = $indexer->diagnose(); | |
| 1155 | + $diagnosis = $this->diagnose(); | |
| 1147 | 1156 | KTUtil::setSystemSetting('indexerDiagnostics', serialize($diagnosis)); |
| 1148 | 1157 | |
| 1149 | - $extractorDiagnosis = $indexer->diagnoseExtractors(); | |
| 1158 | + $extractorDiagnosis = $this->diagnoseExtractors(); | |
| 1150 | 1159 | |
| 1151 | 1160 | KTUtil::setSystemSetting('extractorDiagnostics', serialize($extractorDiagnosis)); |
| 1152 | 1161 | } |
| ... | ... | @@ -1321,7 +1330,7 @@ abstract class Indexer |
| 1321 | 1330 | Indexer::unqueueDocument($docId,sprintf(_kt("indexDocuments: Filename for document id %d starts with a tilde (~). This is assumed to be a temporary file. This is ignored."),$docId), 'error'); |
| 1322 | 1331 | return ; |
| 1323 | 1332 | } |
| 1324 | - | |
| 1333 | + | |
| 1325 | 1334 | $removeFromQueue = true; |
| 1326 | 1335 | if ($indexDocument) |
| 1327 | 1336 | { | ... | ... |