Commit 7e9d33bc0721822d626e11e1703e9cf83df8ab1f

Authored by Megan Watson
1 parent 413fab88

KTS-3895

"Add Document Processing Config options"
Fixed. Added option to disable the indexer and full text searching.

Committed by: Megan Watson
Reviewed by: Donald Jackson



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@9601 c91229c3-7414-0410-bfa2-8a42b809f60b
search2/search/expr.inc.php
@@ -2191,6 +2191,13 @@ class OpExpr extends Expr @@ -2191,6 +2191,13 @@ class OpExpr extends Expr
2191 2191
2192 private function exec_text_query($op, $group) 2192 private function exec_text_query($op, $group)
2193 { 2193 {
  2194 + global $default;
  2195 + // if the indexer has been disabled, return an empty array
  2196 + if(!$default->enableIndexing){
  2197 + $default->log->debug("SEARCH LUCENE: indexer has been disabled.");
  2198 + return array();
  2199 + }
  2200 +
2194 if (($this->getContext() != ExprContext::DOCUMENT) || empty($group)) 2201 if (($this->getContext() != ExprContext::DOCUMENT) || empty($group))
2195 { 2202 {
2196 return array(); 2203 return array();
@@ -2213,7 +2220,6 @@ class OpExpr extends Expr @@ -2213,7 +2220,6 @@ class OpExpr extends Expr
2213 } 2220 }
2214 2221
2215 $indexer = Indexer::get(); 2222 $indexer = Indexer::get();
2216 - global $default;  
2217 $default->log->debug("SEARCH LUCENE: $query"); 2223 $default->log->debug("SEARCH LUCENE: $query");
2218 2224
2219 $results = $indexer->query($query); 2225 $results = $indexer->query($query);
@@ -2317,9 +2323,12 @@ class OpExpr extends Expr @@ -2317,9 +2323,12 @@ class OpExpr extends Expr
2317 } 2323 }
2318 2324
2319 $permResults = array(); 2325 $permResults = array();
2320 - foreach($result[$resultContext] as $idx=>$item) 2326 + if(isset($result[$resultContext]))
2321 { 2327 {
2322 - $permResults[$resultContext][$idx] = $item; 2328 + foreach($result[$resultContext] as $idx=>$item)
  2329 + {
  2330 + $permResults[$resultContext][$idx] = $item;
  2331 + }
2323 } 2332 }
2324 2333
2325 return $permResults; 2334 return $permResults;
sql/mysql/install/data.sql
@@ -276,7 +276,8 @@ INSERT INTO `config_settings` VALUES @@ -276,7 +276,8 @@ INSERT INTO `config_settings` VALUES
276 (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), 276 (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),
277 (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), 277 (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),
278 (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), 278 (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),
279 -(105, 'search', 'Maximum results from SQL query', 'The maximum results from an SQL query', 'maxSqlResults', 'default', '1000', 'numeric_string', NULL, 1); 279 +(105, 'search', 'Maximum results from SQL query', 'The maximum results from an SQL query', 'maxSqlResults', 'default', '1000', 'numeric_string', NULL, 1),
  280 +(106, 'indexer', 'Enable the Document Indexer', 'Enables the indexing of document content for full text searching.', 'enableIndexing', 'default', 'true', 'boolean', NULL, 1);
280 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */; 281 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
281 UNLOCK TABLES; 282 UNLOCK TABLES;
282 283
sql/mysql/upgrade/3.5.5/new_config_settings.sql 0 → 100644
  1 +INSERT INTO `config_settings`
  2 +(group_name, display_name, description, item, value, default_value, type, options, can_edit)
  3 +VALUES
  4 +('indexer', 'Enable the Document Indexer', 'Enables the indexing of document content for full text searching.', 'enableIndexing', 'default', 'true', 'boolean', NULL, 1);
0 \ No newline at end of file 5 \ No newline at end of file