Commit 5b3e63cd5c9b0fab4c68361ebf44e582c0603b94

Authored by kevin_fourie
1 parent b1b78609

Merged in from DEV trunk...

KTS-673
"The search algorithm needs some work"
Updated.

Committed By: Conrad Vermeulen
Reviewed By: Kevin Fourie

KTS-2429
"config.ini must be updated during upgrade for new search to work."
In Progress. Added upgrade function. Still needs testing.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen

KTS-2429
"config.ini must be updated during upgrade for new search to work."
Done.

Committed By: Kevin Fourie
Reviewed By: Conrad Vermeulen



git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7355 c91229c3-7414-0410-bfa2-8a42b809f60b
config/config.ini
@@ -139,7 +139,7 @@ dot = dot @@ -139,7 +139,7 @@ dot = dot
139 139
140 [i18n] 140 [i18n]
141 ; Default language for the interface 141 ; Default language for the interface
142 -defaultLanguage = de_DE 142 +defaultLanguage = en
143 ; If your language doesn't have distinguishable words (usually, doesn't 143 ; If your language doesn't have distinguishable words (usually, doesn't
144 ; have a space character), set useLike to true to use a search that can 144 ; have a space character), set useLike to true to use a search that can
145 ; deal with this, but which is slower. 145 ; deal with this, but which is slower.
lib/upgrades/Ini.inc.php
@@ -40,7 +40,7 @@ class Ini { @@ -40,7 +40,7 @@ class Ini {
40 var $lineNum = 0; 40 var $lineNum = 0;
41 var $exists = ''; 41 var $exists = '';
42 42
43 - function Ini($iniFile = '../../../config.ini') { 43 + function Ini($iniFile = '../../config.ini') {
44 $this->iniFile = $iniFile; 44 $this->iniFile = $iniFile;
45 $this->read($iniFile); 45 $this->read($iniFile);
46 } 46 }
@@ -159,7 +159,7 @@ class Ini { @@ -159,7 +159,7 @@ class Ini {
159 /* 159 /*
160 // USAGE EXAMPLE 160 // USAGE EXAMPLE
161 161
162 -if(file_exists('../../../config.ini')) { 162 +if(file_exists('../../config.ini')) {
163 163
164 $ini = new Ini(); 164 $ini = new Ini();
165 $ini->addItem('Section1', 'NewItem1', 'Some Text1', 'Item1 Comment', 'Section1 Comment'); 165 $ini->addItem('Section1', 'NewItem1', 'Some Text1', 'Item1 Comment', 'Section1 Comment');
lib/upgrades/UpgradeFunctions.inc.php
@@ -29,6 +29,8 @@ @@ -29,6 +29,8 @@
29 * 29 *
30 */ 30 */
31 31
  32 +require_once(KT_LIB_DIR . '/upgrades/Ini.inc.php');
  33 +
32 class UpgradeFunctions { 34 class UpgradeFunctions {
33 var $upgrades = array( 35 var $upgrades = array(
34 '2.0.0' => array('setPermissionFolder'), 36 '2.0.0' => array('setPermissionFolder'),
@@ -46,7 +48,7 @@ class UpgradeFunctions { @@ -46,7 +48,7 @@ class UpgradeFunctions {
46 '3.0.3.7' => array('rebuildAllPermissions'), 48 '3.0.3.7' => array('rebuildAllPermissions'),
47 '3.1.5' => array('upgradeSavedSearches'), 49 '3.1.5' => array('upgradeSavedSearches'),
48 '3.1.6.3' => array('cleanupGroupMembership'), 50 '3.1.6.3' => array('cleanupGroupMembership'),
49 - '3.5.0' => array('cleanupOldKTAdminVersionNotifier', 'registerExtractorMapping'), 51 + '3.5.0' => array('cleanupOldKTAdminVersionNotifier', 'registerExtractorMapping', 'updateConfigFile35'),
50 ); 52 );
51 53
52 var $descriptions = array( 54 var $descriptions = array(
@@ -67,7 +69,8 @@ class UpgradeFunctions { @@ -67,7 +69,8 @@ class UpgradeFunctions {
67 'upgradeSavedSearches' => 'Upgrade saved searches to use namespaces instead of integer ids', 69 'upgradeSavedSearches' => 'Upgrade saved searches to use namespaces instead of integer ids',
68 'cleanupGroupMembership' => 'Cleanup any old references to missing groups, etc.', 70 'cleanupGroupMembership' => 'Cleanup any old references to missing groups, etc.',
69 'cleanupOldKTAdminVersionNotifier' => 'Cleanup any old files from the old KTAdminVersionNotifier', 71 'cleanupOldKTAdminVersionNotifier' => 'Cleanup any old files from the old KTAdminVersionNotifier',
70 - 'registerExtractorMapping' => 'Register document text extractors with the appropriate mime types' 72 + 'registerExtractorMapping' => 'Register document text extractors with the appropriate mime types',
  73 + 'updateConfigFile35' => 'Update the config.ini file for 3.5',
71 ); 74 );
72 var $phases = array( 75 var $phases = array(
73 "setPermissionFolder" => 1, 76 "setPermissionFolder" => 1,
@@ -903,12 +906,83 @@ class UpgradeFunctions { @@ -903,12 +906,83 @@ class UpgradeFunctions {
903 } 906 }
904 // }}} 907 // }}}
905 908
  909 + // {{{ registerExtractorMapping
906 function registerExtractorMapping() 910 function registerExtractorMapping()
907 { 911 {
908 $indexer = Indexer::get(); 912 $indexer = Indexer::get();
909 $indexer->registerTypes(); 913 $indexer->registerTypes();
910 } 914 }
  915 + // }}}
  916 +
  917 + // {{{ updateConfigFile35
  918 + function updateConfigFile35()
  919 + {
  920 + if(file_exists('../../config.ini')) {
  921 +
  922 + $ini = new Ini();
  923 +
  924 + // Webservices Section
  925 + $ini->addItem('webservice', 'uploadDirectory', '${varDirectory}/uploads');
  926 + $ini->addItem('webservice', 'downloadUrl', '${rootUrl}/ktwebservice/download.php');
  927 + $ini->addItem('webservice', 'uploadExpiry', '30');
  928 + $ini->addItem('webservice', 'downloadExpiry', '30');
  929 + $ini->addItem('webservice', 'randomKeyText', 'bkdfjhg23yskjdhf2iu');
  930 + $ini->addItem('webservice', 'validateSessionCount', 'false');
  931 +
  932 + // externalBinary Section
  933 + $ini->addItem('externalBinary', 'xls2csv', 'xls2csv', '', 'The following are external binaries that may be used by various parts of knowledgeTree.');
  934 + $ini->addItem('externalBinary', 'pdftotext', 'pdftotext');
  935 + $ini->addItem('externalBinary', 'catppt', 'catppt');
  936 + $ini->addItem('externalBinary', 'pstotext', 'pstotext');
  937 + $ini->addItem('externalBinary', 'catdoc', 'catdoc');
  938 + $ini->addItem('externalBinary', 'antiword', 'antiword.exe');
  939 +
  940 + // search Section
  941 + $ini->addItem('search', 'resultsPerPage', 'default', "The number of results per page\r\n; defaults to 25");
  942 + $ini->addItem('search', 'dateFormat', 'default', "The date format used when making queries using widgets\r\n; defaults to Y-m-d");
  943 +
  944 + // indexer Section
  945 + $ini->addItem('indexer', 'coreClass', 'JavaXMLRPCLuceneIndexer', "The core indexing class\r\n;coreClass=PHPLuceneIndexer");
  946 + $ini->addItem('indexer', 'batchDocuments', 'default', "The number of documents to be indexed in a cron session\r\n; defaults to 20");
  947 + $ini->addItem('indexer', 'luceneDirectory', '${varDirectory}/indexes', "The location of the lucene indexes");
  948 +
  949 + // openoffice Section
  950 + $ini->addItem('openoffice', 'host', 'default', "The host on which open office is installed\r\n; defaults to localhost");
  951 + $ini->addItem('openoffice', 'port', 'default', "The port on which open office is listening\r\n; defaults to 8100");
  952 +
  953 + // user_prefs Section
  954 + $ini->addItem('user_prefs', 'passwordLength', '6', "The minimum password length on password-setting\r\n; could be moved into DB-auth-config");
  955 + $ini->addItem('user_prefs', 'restrictAdminPasswords', 'default', "Apply the minimum password length to admin while creating / editing accounts?\r\n; default is set to \"false\" meaning that admins can create users with shorter passwords.");
  956 + $ini->addItem('user_prefs', 'restrictPreferences', 'false', "Restrict users from accessing their preferences menus?");
  957 +
  958 + // builtinauth Section
  959 + $ini->addItem('builtinauth', 'password_change_interval', '30', "This would force users that use the built-in authentication provider\r\n; to have to change their passwords every 30 days." ,"This is configuration for the built-in authentication provider");
  960 +
  961 + // cache Section
  962 + $ini->addItem('cache', 'cacheEnabled', 'true', '', "Enable/disable the cache and set the cache location");
  963 + $ini->addItem('cache', 'cacheDirectory', '${varDirectory}/cache');
  964 +
  965 + // KTWebDAVSettings Section
  966 + $ini->addItem('KTWebDAVSettings', 'debug', 'off', '_LOTS_ of debug info will be logged if the following is "on"', 'This section is for KTWebDAV only');
  967 + $ini->addItem('KTWebDAVSettings', 'safemode', 'on', 'To allow write access to WebDAV clients set safe mode to "off" below');
  968 +
  969 + // BaobabSettings Section
  970 + $ini->addItem('BaobabSettings', 'debug', 'off', '_LOTS_ of debug info will be logged if the following is "on"', 'This section is for Boabab only');
  971 + $ini->addItem('BaobabSettings', 'safemode', 'on', 'To allow write access to WebDAV clients set safe mode to "off" below');
  972 +
  973 + // backup Section
  974 + $ini->addItem('backup', 'backupDirectory', 'default', "Identify location of kt-backup for database backups\r\n;backupDirectory = c:/kt-backups\r\n;backupDirectory = /tmp/kt-backups");
  975 + $ini->addItem('backup', 'mysqlDirectory', 'default', "Identify the location of the mysql.exe and mysqldump.exe\r\n;mysqlDirectory = c:/program files/ktdms/mysql/bin");
  976 +
  977 + // clientToolPolicies Section
  978 + $ini->addItem('clientToolPolicies', 'explorerMetadataCapture', 'true', "These two settings control whether or not the client is prompted for metadata when a\r\n;document is added to knowledgetree via KTtools. They default to true.");
  979 + $ini->addItem('clientToolPolicies', 'officeMetadataCapture', 'true');
  980 +
  981 + $ini->write();
911 982
  983 + }
  984 + }
  985 + // }}}
912 } 986 }
913 987
914 ?> 988 ?>
search2/indexing/bin/registerTypes.php
@@ -12,21 +12,14 @@ @@ -12,21 +12,14 @@
12 */ 12 */
13 13
14 session_start(); 14 session_start();
15 -print _kt("Registering Extractor mapping to Mime types") . "...\n";  
16 -  
17 require_once(realpath('../../../config/dmsDefaults.php')); 15 require_once(realpath('../../../config/dmsDefaults.php'));
18 16
  17 +print _kt("Registering Extractor mapping to Mime types") . "...\n";
  18 +
19 $config = KTConfig::getSingleton(); 19 $config = KTConfig::getSingleton();
20 $indexer = $config->get('indexer/coreClass'); 20 $indexer = $config->get('indexer/coreClass');
21 21
22 -if ($indexer != 'PHPLuceneIndexer')  
23 -{  
24 - print _kt("This script only works with the PHPLuceneIndexer.") . "\n";  
25 - exit;  
26 -}  
27 -  
28 require_once('indexing/indexerCore.inc.php'); 22 require_once('indexing/indexerCore.inc.php');
29 -  
30 $clear=false; 23 $clear=false;
31 if ($argc > 0) 24 if ($argc > 0)
32 { 25 {
templates/ktcore/search2/external_resources.smarty 0 → 100644
  1 +<h1>{i18n}External Resource Dependency Status{/i18n}</h1>
  2 +<P>
  3 +{i18n}The following resources are used by KnowledgeTree and are impacting on the normal operations of the system:{/i18n}
  4 +<table width="100%">
  5 +<tr><th width="150">{i18n}Resource{/i18n}</th><th>{i18n}Status{/i18n}</th></tr>
  6 +{foreach from=$resources item=resource}
  7 +<tr><td valign=top><I>{$resource.name}</td><td>{$resource.status}</td>
  8 +<tr ><td colspan=2><hr></tr>
  9 +{/foreach}
  10 +<tr><td colspan=2 align=right><a href="/search2.php?action=refreshDashboardStatus" align=right>{i18n}Refresh{/i18n}</a></tr>
  11 +</table>
templates/ktcore/search2/indexing_status.smarty 0 → 100644
  1 +{if !empty($indexerDiagnosis)}
  2 +{i18n arg_name=$indexerName}The #name# is not functioning correctly. This could be because:{/i18n}
  3 +<ul>
  4 +<li>{i18n}The indexer is not configured correctly.{/i18n}
  5 +<li>{i18n}The component on which the indexer depends is not available.{/i18n}
  6 +</ul>
  7 +{$indexerDiagnosis}
  8 +<br>
  9 +{/if}
  10 +{if count($extractorDiagnosis) > 0}
  11 +<br>
  12 +<b>{i18n}Text Extractor Status{/i18n}</b>
  13 +<br>
  14 +{i18n}KnowledgeTree has detected some issues with some of the text extractors used to index document text:{/i18n}
  15 +<br>
  16 +<table width="100%">
  17 + <tr><td colspan=2><hr></td></tr>
  18 +{foreach from=$extractorDiagnosis item=diagnosis}
  19 + <tr>
  20 + <td colspan=2><i>{$diagnosis.problem}</i></td>
  21 + </tr>
  22 + <tr>
  23 + <td valign="top" width="100"><nobr>{i18n}Text extractor(s)s affected:{/i18n}</td>
  24 + <td align="left" valign=top><ul style="top: -30px">
  25 + {foreach from=$diagnosis.indexers item=indexer}
  26 + <li><i>{$indexer}</i></li>
  27 + {/foreach}
  28 + </ul>
  29 + </td>
  30 + </tr>
  31 + <tr><td colspan=2><hr></td></tr>
  32 +{/foreach}
  33 +</table>
  34 +{/if}
  35 +<br>
  36 +<B>{i18n}Note:{/i18n}</b> {i18n}Indexing will not continue until all issues have been resolved.{/i18n}
  37 +<table width="100%">
  38 +<tr>
  39 +<td align=right><a href="/search2.php?action=refreshDashboardStatus">Refresh</a>
  40 +</table>
templates/ktcore/search2/lucene_migration.smarty 0 → 100644
  1 +<P>
  2 +Migration to using the new search requires text to be moved from the database full text indexes into the Lucene indexes. This may take some time depending
  3 +on the size of the repository. For this reason, the process is a background task.
  4 +<P>
  5 +
  6 +<table>
  7 +<tr><td>Documents processed in a single migration run:</td><td>20</td></tr>
  8 +<tr><td>Frequency at which migration batch task runs:</td><td>every 5 minutes</td></tr>
  9 +<tr><td>Total documents to migrate:</td><td>1500</td></tr>
  10 +<tr><td>Migration process started on:</td><td>2007-01-10 15:13</td></tr>
  11 +<tr><td>Migration process has taken:</td><td>15 hours 10 minutes</td></tr>
  12 +<tr><td>Total documents migrated:</td><td>1500</td></tr>
  13 +<tr><td>Total documents to be migrated:</td><td>1500</td></tr>
  14 +<tr><td>Estimated completion time:</td><td>2007-01-10 15:13</td></tr>
  15 +<tr><td>Estimated migration time remaining:</td><td>15 hours 10 minutes</td></tr>
  16 +</table>
  17 +<B>Note:</b> <i>Search results will not be accurate until the migration process is complete.</i>
  18 +<br>This dashlet will disappear when the migration process is complete.
  19 +
  20 +<br>
0 \ No newline at end of file 21 \ No newline at end of file
templates/ktcore/search2/lucene_statistics.smarty 0 → 100644
  1 +<P>
  2 +This dashlet provides some basic statistics on the Lucene index.
  3 +<P>
  4 +
  5 +<table>
  6 +<tr><td>Last optimisation date:</td><td>{$stats.optimisationDate}</td></tr>
  7 +<tr><td>Period since last optimisation:</td><td>{$stats.optimisationPeriod}</td></tr>
  8 +<tr><td>Last indexing date:</td><td>{$stats.indexingDate}</td></tr>
  9 +<tr><td>Period since last indexing:</td><td>{$stats.indexingPeriod}</td></tr>
  10 +<tr><td>Total documents in repository:</td><td>{$stats.docsInRepository}</td></tr>
  11 +<tr><td>Documents in index:</td><td>{$stats.docsInIndex}</td></tr>
  12 +<tr><td>Documents in indexing queue:</td><td>{$stats.docsInQueue}</td></tr>
  13 +<tr><td>Indexing coverage:</td><td>{$stats.indexingCoverage}</td></tr>
  14 +<tr><td>Queue coverage:</td><td>{$stats.queueCoverage}</td></tr>
  15 +</table>
  16 +<b>Notes:</b><br>
  17 +<table>
  18 +<tr><td valign=top>*<td>Not all documents contain text. This will explain why the indexing coverage percentage my vary.
  19 +<tr><td valign=top>*<td>The queue coverage indicates how many documents are in the queue in relation to the repository size.
  20 +{if $stats.noOptimisation}
  21 +<tr><td valign=top>*<td><i>To get the best performance out of Lucene, the indexes must be optimised periodically. This is managed by a background task.
  22 +{/if}
  23 +</table>
  24 +<table width="100%">
  25 +<tr><td colspan=2 align=right><a href="/search2.php?action=refreshLuceneStats" align=right>Refresh</a></tr>
  26 +</table>
0 \ No newline at end of file 27 \ No newline at end of file