r1285@llin: dpavlin | 2007-06-21 14:53:43 +0200
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 21 Jun 2007 12:53:41 +0000 (12:53 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 21 Jun 2007 12:53:41 +0000 (12:53 +0000)
 make indexers optional [2.30]

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@866 07558da8-63fa-0310-ba24-9fe276d99e06

TODO
lib/WebPAC.pm
lib/WebPAC/Config.pm
run.pl

diff --git a/TODO b/TODO
index 2555bd0..2e79a74 100644 (file)
--- a/TODO
+++ b/TODO
@@ -38,8 +38,8 @@
 + add set and get to create in-memory lookup
 + support marc_remove('*')
 + fix-length fields (<100) support [2.29]
++ work without indexers installed or enabled [2.30]
 - simpliest possible conf/default.yml as example
-- work without search engines installed or enabled
 - load_ds/save_ds should use on-disk hash to preserve inodes
 - leader(position,...), indicator(field,nr) nr=1|2 for MARC input
 - validate should ignore modify_file
index 9269c05..4936402 100644 (file)
@@ -9,11 +9,11 @@ WebPAC - core module
 
 =head1 VERSION
 
-Version 2.29
+Version 2.30
 
 =cut
 
-our $VERSION = '2.29';
+our $VERSION = '2.30';
 
 =head1 SYNOPSIS
 
index f83ac12..23abac5 100644 (file)
@@ -92,9 +92,8 @@ Which indexer are we using?
 
 sub use_indexer {
        my $self = shift;
-       my $default = 'hyperestraier';
        return unless ($self->{config});
-       return $self->{config}->{use_indexer} || $default;
+       return $self->{config}->{use_indexer} || undef;
 }
 
 =head2 get
diff --git a/run.pl b/run.pl
index c324c65..036b1bb 100755 (executable)
--- a/run.pl
+++ b/run.pl
@@ -185,7 +185,7 @@ $stats ||= $validate;
 if ($stats) {
        $log->debug("disabled indexing for stats collection");
        $use_indexer = undef;
-} else {
+} elsif ( $use_indexer ) {
        $log->info("using $use_indexer indexing engine...");
 }
 
@@ -244,19 +244,19 @@ foreach my $database ( sort keys %{ $config->databases } ) {
                if ($use_indexer eq 'hyperestraier') {
 
                        # open Hyper Estraier database
-                       use WebPAC::Output::Estraier '0.10';
+                       require WebPAC::Output::Estraier;
                        $indexer = new WebPAC::Output::Estraier( %{ $indexer_config } );
                
                } elsif ($use_indexer eq 'hyperestraier-native') {
 
                        # open Hyper Estraier database
-                       use WebPAC::Output::EstraierNative;
+                       require WebPAC::Output::EstraierNative;
                        $indexer = new WebPAC::Output::EstraierNative( %{ $indexer_config } );
 
                } elsif ($use_indexer eq 'kinosearch') {
 
                        # open KinoSearch
-                       use WebPAC::Output::KinoSearch;
+                       require WebPAC::Output::KinoSearch;
                        $indexer_config->{clean} = 1 unless (-e $indexer_config->{index_path});
                        $indexer = new WebPAC::Output::KinoSearch( %{ $indexer_config } );
 
@@ -264,7 +264,7 @@ foreach my $database ( sort keys %{ $config->databases } ) {
                        $log->logdie("unknown use_indexer: $use_indexer");
                }
 
-               $log->logide("can't continue without valid indexer") unless ($indexer);
+               $log->logdie("can't continue without valid indexer") unless ($indexer);
        }