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,12 +89,8 @@ class IndexingStatusDispatcher extends KTAdminDispatcher | ||
| 89 | // --------------------------- | 89 | // --------------------------- |
| 90 | 90 | ||
| 91 | // Do a run time check for extractors not working | 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 | // Create an Array to store errors | 95 | // Create an Array to store errors |
| 100 | $this->extractorErrors = array(); | 96 | $this->extractorErrors = array(); |
plugins/search2/reporting/LuceneStatistics.php
| @@ -38,6 +38,7 @@ | @@ -38,6 +38,7 @@ | ||
| 38 | 38 | ||
| 39 | require_once(KT_LIB_DIR . '/dispatcher.inc.php'); | 39 | require_once(KT_LIB_DIR . '/dispatcher.inc.php'); |
| 40 | require_once(KT_LIB_DIR . '/templating/templating.inc.php'); | 40 | require_once(KT_LIB_DIR . '/templating/templating.inc.php'); |
| 41 | +require_once(KT_DIR . '/search2/indexing/indexerCore.inc.php'); | ||
| 41 | 42 | ||
| 42 | class LuceneStatisticsDispatcher extends KTAdminDispatcher | 43 | class LuceneStatisticsDispatcher extends KTAdminDispatcher |
| 43 | { | 44 | { |
| @@ -46,19 +47,18 @@ class LuceneStatisticsDispatcher extends KTAdminDispatcher | @@ -46,19 +47,18 @@ class LuceneStatisticsDispatcher extends KTAdminDispatcher | ||
| 46 | */ | 47 | */ |
| 47 | function do_main() { | 48 | function do_main() { |
| 48 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Document Indexer Statistics')); | 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 | $oTemplating =& KTTemplating::getSingleton(); | 54 | $oTemplating =& KTTemplating::getSingleton(); |
| 55 | $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_statistics'); | 55 | $oTemplate = $oTemplating->loadTemplate('ktcore/search2/lucene_statistics'); |
| 56 | - | 56 | + |
| 57 | $aTemplateData = array( | 57 | $aTemplateData = array( |
| 58 | 'context' => $this, | 58 | 'context' => $this, |
| 59 | - 'stats'=>$this->stats | 59 | + 'stats' => $stats |
| 60 | ); | 60 | ); |
| 61 | - | 61 | + |
| 62 | return $oTemplate->render($aTemplateData); | 62 | return $oTemplate->render($aTemplateData); |
| 63 | } | 63 | } |
| 64 | } | 64 | } |
search2/indexing/indexerCore.inc.php
| @@ -410,7 +410,7 @@ class FolderShortcutResultItem extends ProxyResultItem | @@ -410,7 +410,7 @@ class FolderShortcutResultItem extends ProxyResultItem | ||
| 410 | var $parentId; | 410 | var $parentId; |
| 411 | var $linkedId; | 411 | var $linkedId; |
| 412 | var $full_path; | 412 | var $full_path; |
| 413 | - | 413 | + |
| 414 | public function getFolderID() { return $this->getId(); } | 414 | public function getFolderID() { return $this->getId(); } |
| 415 | public function getMimeIconPath() { return 'folder_shortcut'; } | 415 | public function getMimeIconPath() { return 'folder_shortcut'; } |
| 416 | 416 | ||
| @@ -759,6 +759,11 @@ abstract class Indexer | @@ -759,6 +759,11 @@ abstract class Indexer | ||
| 759 | { | 759 | { |
| 760 | $content = file_get_contents($filename); | 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 | $src = array("([\r\n])","([\n][\n])","([\n])","([\t])",'([ ][ ])'); | 767 | $src = array("([\r\n])","([\n][\n])","([\n])","([\t])",'([ ][ ])'); |
| 763 | $tgt = array("\n","\n",' ',' ',' '); | 768 | $tgt = array("\n","\n",' ',' ',' '); |
| 764 | 769 | ||
| @@ -1057,7 +1062,7 @@ abstract class Indexer | @@ -1057,7 +1062,7 @@ abstract class Indexer | ||
| 1057 | return Indexer::getIndexingQueue(false); | 1062 | return Indexer::getIndexingQueue(false); |
| 1058 | } | 1063 | } |
| 1059 | 1064 | ||
| 1060 | - public function updateIndexStats() | 1065 | + public function getIndexStatistics() |
| 1061 | { | 1066 | { |
| 1062 | $optimisationDate = KTUtil::getSystemSetting('luceneOptimisationDate', ''); | 1067 | $optimisationDate = KTUtil::getSystemSetting('luceneOptimisationDate', ''); |
| 1063 | 1068 | ||
| @@ -1139,14 +1144,18 @@ abstract class Indexer | @@ -1139,14 +1144,18 @@ abstract class Indexer | ||
| 1139 | 'noOptimisation'=>$noOptimisation | 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 | KTUtil::setSystemSetting('indexerDiagnostics', serialize($diagnosis)); | 1156 | KTUtil::setSystemSetting('indexerDiagnostics', serialize($diagnosis)); |
| 1148 | 1157 | ||
| 1149 | - $extractorDiagnosis = $indexer->diagnoseExtractors(); | 1158 | + $extractorDiagnosis = $this->diagnoseExtractors(); |
| 1150 | 1159 | ||
| 1151 | KTUtil::setSystemSetting('extractorDiagnostics', serialize($extractorDiagnosis)); | 1160 | KTUtil::setSystemSetting('extractorDiagnostics', serialize($extractorDiagnosis)); |
| 1152 | } | 1161 | } |
| @@ -1321,7 +1330,7 @@ abstract class Indexer | @@ -1321,7 +1330,7 @@ abstract class Indexer | ||
| 1321 | 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'); | 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 | return ; | 1331 | return ; |
| 1323 | } | 1332 | } |
| 1324 | - | 1333 | + |
| 1325 | $removeFromQueue = true; | 1334 | $removeFromQueue = true; |
| 1326 | if ($indexDocument) | 1335 | if ($indexDocument) |
| 1327 | { | 1336 | { |