Commit 03fc43f80ba90a8fea2df1c4033604cd260712e2
1 parent
fffd993a
KTS-673
"The search algorithm needs some work" Updated. Made some scripts more user friendly. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7238 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
5 changed files
with
120 additions
and
7 deletions
search2/indexing/bin/cronIndexer.php
search2/indexing/bin/diagnose.php
| ... | ... | @@ -9,9 +9,27 @@ |
| 9 | 9 | require_once(realpath('../../../config/dmsDefaults.php')); |
| 10 | 10 | require_once('indexing/indexerCore.inc.php'); |
| 11 | 11 | |
| 12 | +print "Diagnosing the text extractors...\n"; | |
| 13 | + | |
| 12 | 14 | $indexer = Indexer::get(); |
| 13 | 15 | $diagnoses = $indexer->diagnose(); |
| 14 | 16 | |
| 15 | -var_dump($diagnoses); | |
| 17 | +if (count($diagnoses) == 0) | |
| 18 | +{ | |
| 19 | + print "There don't appear to be any problems.\n"; | |
| 20 | +} | |
| 21 | +else | |
| 22 | +{ | |
| 23 | + foreach($diagnoses as $key=>$value) | |
| 24 | + { | |
| 25 | + $name = $value['name']; | |
| 26 | + $diagnosis = $value['diagnosis']; | |
| 27 | + | |
| 28 | + print "\nExtractor: $name ($key)\n"; | |
| 29 | + print "* $diagnosis\n"; | |
| 30 | + } | |
| 31 | +} | |
| 32 | + | |
| 33 | +print "\nDone.\n"; | |
| 16 | 34 | |
| 17 | 35 | ?> |
| 18 | 36 | \ No newline at end of file | ... | ... |
search2/indexing/bin/optimise.php
| ... | ... | @@ -9,7 +9,11 @@ |
| 9 | 9 | require_once(realpath('../../../config/dmsDefaults.php')); |
| 10 | 10 | require_once('indexing/indexerCore.inc.php'); |
| 11 | 11 | |
| 12 | +print "Optimising Lucene index...\n"; | |
| 13 | + | |
| 12 | 14 | $indexer = Indexer::get(); |
| 13 | 15 | $indexer->optimise(); |
| 14 | 16 | |
| 17 | +print "Done.\n"; | |
| 18 | + | |
| 15 | 19 | ?> |
| 16 | 20 | \ No newline at end of file | ... | ... |
search2/indexing/bin/recreateIndex.php
| ... | ... | @@ -9,19 +9,62 @@ |
| 9 | 9 | * |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if (true) | |
| 12 | +session_start(); | |
| 13 | +print "Recreate Lucene index...\n"; | |
| 14 | + | |
| 15 | +$sure=false; | |
| 16 | +$indexall = false; | |
| 17 | +if ($argc > 0) | |
| 13 | 18 | { |
| 14 | - die('are you sure?'); | |
| 19 | + foreach($argv as $arg) | |
| 20 | + { | |
| 21 | + switch (strtolower($arg)) | |
| 22 | + { | |
| 23 | + case 'positive': | |
| 24 | + $sure=true; | |
| 25 | + break; | |
| 26 | + case 'indexall': | |
| 27 | + $indexall=true; | |
| 28 | + break; | |
| 29 | + case 'help': | |
| 30 | + print "Usage: recreateIndex.php [positive] [indexall]\n"; | |
| 31 | + exit; | |
| 32 | + } | |
| 33 | + } | |
| 34 | +} | |
| 35 | +if (!$sure) | |
| 36 | +{ | |
| 37 | + print "* Are you sure you want to do this? Add 'positive' as a parameter to continue.\n"; | |
| 38 | + exit; | |
| 15 | 39 | } |
| 16 | 40 | |
| 17 | -session_start(); | |
| 41 | + | |
| 18 | 42 | require_once(realpath('../../../config/dmsDefaults.php')); |
| 43 | + | |
| 44 | +$config = KTConfig::getSingleton(); | |
| 45 | +$indexer = $config->get('indexer/coreClass'); | |
| 46 | + | |
| 47 | +if ($indexer != 'PHPLuceneIndexer') | |
| 48 | +{ | |
| 49 | + print "This script only works with the PHPLuceneIndexer.\n"; | |
| 50 | + exit; | |
| 51 | +} | |
| 52 | + | |
| 19 | 53 | require_once('indexing/indexerCore.inc.php'); |
| 20 | 54 | require_once('indexing/indexers/PHPLuceneIndexer.inc.php'); |
| 21 | 55 | |
| 56 | + | |
| 57 | + | |
| 22 | 58 | PHPLuceneIndexer::createIndex(); |
| 23 | -PHPLuceneIndexer::indexAll(); | |
| 59 | +print "\n* The lucene index has been recreated.\n"; | |
| 60 | + | |
| 61 | +if ($indexall) | |
| 62 | +{ | |
| 63 | + PHPLuceneIndexer::indexAll(); | |
| 64 | + print "\n* All documents are scheduled for indexing.\n"; | |
| 65 | +} | |
| 66 | + | |
| 67 | +print "Done.\n"; | |
| 24 | 68 | |
| 25 | -print "The lucene index has been deleted. All documents are now in the queue.\n"; | |
| 26 | 69 | |
| 27 | 70 | ?> |
| 28 | 71 | \ No newline at end of file | ... | ... |
search2/indexing/bin/registerTypes.php
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +/** | |
| 4 | + * PURPOSE: | |
| 5 | + * | |
| 6 | + * The purpose of this script is to register types. | |
| 7 | + * | |
| 8 | + * Usage: registerTypes.php [clear] | |
| 9 | + * | |
| 10 | + * If 'clear' is specified, mime type mappings will be cleared. | |
| 11 | + * | |
| 12 | + */ | |
| 13 | + | |
| 14 | +session_start(); | |
| 15 | +print "Registering Extractor mapping to Mime types...\n"; | |
| 16 | + | |
| 3 | 17 | require_once(realpath('../../../config/dmsDefaults.php')); |
| 18 | + | |
| 19 | +$config = KTConfig::getSingleton(); | |
| 20 | +$indexer = $config->get('indexer/coreClass'); | |
| 21 | + | |
| 22 | +if ($indexer != 'PHPLuceneIndexer') | |
| 23 | +{ | |
| 24 | + print "This script only works with the PHPLuceneIndexer.\n"; | |
| 25 | + exit; | |
| 26 | +} | |
| 27 | + | |
| 4 | 28 | require_once('indexing/indexerCore.inc.php'); |
| 5 | 29 | |
| 30 | +$clear=false; | |
| 31 | +if ($argc > 0) | |
| 32 | +{ | |
| 33 | + foreach($argv as $arg) | |
| 34 | + { | |
| 35 | + switch (strtolower($arg)) | |
| 36 | + { | |
| 37 | + case 'clear': | |
| 38 | + $clear=true; | |
| 39 | + print "* Clearing mime type associations\n"; | |
| 40 | + break; | |
| 41 | + case 'help': | |
| 42 | + print "Usage: registerTypes.php [clear]\n"; | |
| 43 | + exit; | |
| 44 | + } | |
| 45 | + if (strtolower($arg) == 'clear') | |
| 46 | + { | |
| 47 | + $clear=true; | |
| 48 | + } | |
| 49 | + } | |
| 50 | +} | |
| 51 | + | |
| 6 | 52 | $indexer = Indexer::get(); |
| 7 | -$indexer->registerTypes(true); | |
| 53 | +$indexer->registerTypes($clear); | |
| 8 | 54 | |
| 55 | +print "Done.\n"; | |
| 9 | 56 | ?> |
| 10 | 57 | \ No newline at end of file | ... | ... |