Commit a6a78106bae69da686334f7a9fc7b2b8224518cc
1 parent
cf0dd2c0
KTS-673
"The search algorithm needs some work" Updated. Committed By: Conrad Vermeulen Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7475 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
44 additions
and
1 deletions
search2/indexing/indexerCore.inc.php
| ... | ... | @@ -330,7 +330,11 @@ abstract class Indexer |
| 330 | 330 | public function clearExtractors() |
| 331 | 331 | { |
| 332 | 332 | global $default; |
| 333 | - $sql = "update mime_types set extractor=null"; | |
| 333 | + | |
| 334 | + $sql = "update mime_types set extractor_id=null"; | |
| 335 | + DBUtil::runQuery($sql); | |
| 336 | + | |
| 337 | + $sql = "delete from mime_extractors"; | |
| 334 | 338 | DBUtil::runQuery($sql); |
| 335 | 339 | |
| 336 | 340 | $default->log->debug('clearExtractors'); |
| ... | ... | @@ -616,6 +620,43 @@ abstract class Indexer |
| 616 | 620 | } |
| 617 | 621 | |
| 618 | 622 | /** |
| 623 | + * This does the initial mime type association between mime types and text extractors | |
| 624 | + * | |
| 625 | + */ | |
| 626 | + public function checkForRegisteredTypes() | |
| 627 | + { | |
| 628 | + global $default; | |
| 629 | + | |
| 630 | + // we are only doing this once! | |
| 631 | + $initRegistered = KTUtil::getSystemSetting('mimeTypesRegistered', false); | |
| 632 | + if ($initRegistered) | |
| 633 | + { | |
| 634 | + return; | |
| 635 | + } | |
| 636 | + $default->log->info('checkForRegisteredTypes: start'); | |
| 637 | + | |
| 638 | + $this->registerTypes(true); | |
| 639 | + | |
| 640 | + | |
| 641 | + $disable = array( | |
| 642 | + OS_WINDOWS=>array('PSExtractor'), | |
| 643 | + OS_UNIX => array() | |
| 644 | + | |
| 645 | + ); | |
| 646 | + | |
| 647 | + foreach($disable[OS_WINDOWS] as $extractor) | |
| 648 | + { | |
| 649 | + $sql = "UPDATE mime_extractors SET active=0 WHERE name='$extractor'"; | |
| 650 | + DBUtil::runQuery($sql); | |
| 651 | + $default->log->info("checkForRegisteredTypes: disabled '$extractor'"); | |
| 652 | + } | |
| 653 | + | |
| 654 | + $default->log->info('checkForRegisteredTypes: done'); | |
| 655 | + KTUtil::setSystemSetting('mimeTypesRegistered', true); | |
| 656 | + } | |
| 657 | + | |
| 658 | + | |
| 659 | + /** | |
| 619 | 660 | * The main function that may be called repeatedly to index documents. |
| 620 | 661 | * |
| 621 | 662 | * @param int $max Default 20 |
| ... | ... | @@ -624,6 +665,8 @@ abstract class Indexer |
| 624 | 665 | { |
| 625 | 666 | global $default; |
| 626 | 667 | |
| 668 | + $this->checkForRegisteredTypes(); | |
| 669 | + | |
| 627 | 670 | $default->log->info('indexDocuments: start'); |
| 628 | 671 | if (!$this->doesDiagnosticsPass()) |
| 629 | 672 | { | ... | ... |