diff --git a/search2/search/expr.inc.php b/search2/search/expr.inc.php index 3d94700..e4025fe 100755 --- a/search2/search/expr.inc.php +++ b/search2/search/expr.inc.php @@ -2191,6 +2191,13 @@ class OpExpr extends Expr private function exec_text_query($op, $group) { + global $default; + // if the indexer has been disabled, return an empty array + if(!$default->enableIndexing){ + $default->log->debug("SEARCH LUCENE: indexer has been disabled."); + return array(); + } + if (($this->getContext() != ExprContext::DOCUMENT) || empty($group)) { return array(); @@ -2213,7 +2220,6 @@ class OpExpr extends Expr } $indexer = Indexer::get(); - global $default; $default->log->debug("SEARCH LUCENE: $query"); $results = $indexer->query($query); @@ -2317,9 +2323,12 @@ class OpExpr extends Expr } $permResults = array(); - foreach($result[$resultContext] as $idx=>$item) + if(isset($result[$resultContext])) { - $permResults[$resultContext][$idx] = $item; + foreach($result[$resultContext] as $idx=>$item) + { + $permResults[$resultContext][$idx] = $item; + } } return $permResults; diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql index 938195d..d144e69 100644 --- a/sql/mysql/install/data.sql +++ b/sql/mysql/install/data.sql @@ -276,7 +276,8 @@ INSERT INTO `config_settings` VALUES (102, 'tweaks', 'Update Document Version (Content) on Editing Metadata', 'The document version is equivalent to the document content version. When set to true the document version will be increased when the document metadata is updated.', 'updateContentVersion', 'default', 'false', 'boolean', NULL, 1), (103, 'tweaks', 'Always Force Original Filename on Checkin', 'When set to true, the checkbox for "Force Original Filename" will be hidden on check-in. This ensures that the filename will always stay the same.', 'disableForceFilenameOption', 'default', 'false', 'boolean', NULL, 1), (104, 'KnowledgeTree', 'The Location of the Mime Magic File', 'The path to the mime magic database file.', 'magicDatabase', 'default', '/usr/share/file/magic', 'string', NULL, 1), -(105, 'search', 'Maximum results from SQL query', 'The maximum results from an SQL query', 'maxSqlResults', 'default', '1000', 'numeric_string', NULL, 1); +(105, 'search', 'Maximum results from SQL query', 'The maximum results from an SQL query', 'maxSqlResults', 'default', '1000', 'numeric_string', NULL, 1), +(106, 'indexer', 'Enable the Document Indexer', 'Enables the indexing of document content for full text searching.', 'enableIndexing', 'default', 'true', 'boolean', NULL, 1); /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/mysql/upgrade/3.5.5/new_config_settings.sql b/sql/mysql/upgrade/3.5.5/new_config_settings.sql new file mode 100644 index 0000000..b9ac7e7 --- /dev/null +++ b/sql/mysql/upgrade/3.5.5/new_config_settings.sql @@ -0,0 +1,4 @@ +INSERT INTO `config_settings` +(group_name, display_name, description, item, value, default_value, type, options, can_edit) +VALUES +('indexer', 'Enable the Document Indexer', 'Enables the indexing of document content for full text searching.', 'enableIndexing', 'default', 'true', 'boolean', NULL, 1); \ No newline at end of file