From a6a78106bae69da686334f7a9fc7b2b8224518cc Mon Sep 17 00:00:00 2001 From: Conrad Vermeulen Date: Mon, 22 Oct 2007 22:30:38 +0000 Subject: [PATCH] KTS-673 "The search algorithm needs some work" Updated. --- search2/indexing/indexerCore.inc.php | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/search2/indexing/indexerCore.inc.php b/search2/indexing/indexerCore.inc.php index d2fccae..02cffa9 100755 --- a/search2/indexing/indexerCore.inc.php +++ b/search2/indexing/indexerCore.inc.php @@ -330,7 +330,11 @@ abstract class Indexer public function clearExtractors() { global $default; - $sql = "update mime_types set extractor=null"; + + $sql = "update mime_types set extractor_id=null"; + DBUtil::runQuery($sql); + + $sql = "delete from mime_extractors"; DBUtil::runQuery($sql); $default->log->debug('clearExtractors'); @@ -616,6 +620,43 @@ abstract class Indexer } /** + * This does the initial mime type association between mime types and text extractors + * + */ + public function checkForRegisteredTypes() + { + global $default; + + // we are only doing this once! + $initRegistered = KTUtil::getSystemSetting('mimeTypesRegistered', false); + if ($initRegistered) + { + return; + } + $default->log->info('checkForRegisteredTypes: start'); + + $this->registerTypes(true); + + + $disable = array( + OS_WINDOWS=>array('PSExtractor'), + OS_UNIX => array() + + ); + + foreach($disable[OS_WINDOWS] as $extractor) + { + $sql = "UPDATE mime_extractors SET active=0 WHERE name='$extractor'"; + DBUtil::runQuery($sql); + $default->log->info("checkForRegisteredTypes: disabled '$extractor'"); + } + + $default->log->info('checkForRegisteredTypes: done'); + KTUtil::setSystemSetting('mimeTypesRegistered', true); + } + + + /** * The main function that may be called repeatedly to index documents. * * @param int $max Default 20 @@ -624,6 +665,8 @@ abstract class Indexer { global $default; + $this->checkForRegisteredTypes(); + $default->log->info('indexDocuments: start'); if (!$this->doesDiagnosticsPass()) { -- libgit2 0.21.4