Index: /gsdl/trunk/perllib/basebuilder.pm
===================================================================
--- /gsdl/trunk/perllib/basebuilder.pm	(revision 20646)
+++ /gsdl/trunk/perllib/basebuilder.pm	(revision 20647)
@@ -56,5 +56,5 @@
 sub new {
     my ($class, $collection, $source_dir, $build_dir, $verbosity, 
-	$maxdocs, $debug, $keepold, $incremental,
+	$maxdocs, $debug, $keepold, $incremental, $incremental_mode,
 	$remove_empty_classifications, 
 	$outhandle, $no_text, $failhandle, $gli, $disable_OAI) = @_;
@@ -73,4 +73,5 @@
 		      'keepold'=>$keepold,
 		      'incremental'=>$incremental,
+		      'incremental_mode'=>$incremental_mode,
 		      'remove_empty_classifications'=>$remove_empty_classifications,
 		      'outhandle'=>$outhandle,
@@ -102,32 +103,4 @@
     $self->{'infodbtype'} = $self->{'collect_cfg'}->{'infodbtype'} || &dbutil::get_default_infodb_type();
 
-    # get the list of plugins for this collection
-    my $plugins = [];
-    if (defined $self->{'collect_cfg'}->{'plugin'}) {
-	$plugins = $self->{'collect_cfg'}->{'plugin'};
-    }
-    
-    # load all the plugins
-
-    #build up the extra global options for the plugins
-    my @global_opts = ();
-    if (defined $self->{'collect_cfg'}->{'separate_cjk'} && $self->{'collect_cfg'}->{'separate_cjk'} =~ /^true$/i) {
-	push @global_opts, "-separate_cjk";
-    }
-    $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $verbosity, $outhandle, $failhandle, \@global_opts, $keepold);
-   
-    if (scalar(@{$self->{'pluginfo'}}) == 0) {
-	print $outhandle "No plugins were loaded.\n";
-	die "\n";
-    }
-
-    # get the list of classifiers for this collection
-    my $classifiers = [];
-    if (defined $self->{'collect_cfg'}->{'classify'}) {
-	$classifiers = $self->{'collect_cfg'}->{'classify'};
-    }
-
-    # load all the classifiers
-    $self->{'classifiers'} = &classify::load_classifiers ($classifiers, $build_dir, $outhandle);
 
     # load up any dontdb fields
@@ -147,4 +120,7 @@
     my $self = shift(@_);
     
+    my $outhandle = $self->{'outhandle'};
+    my $failhandle = $self->{'failhandle'};
+
     $self->generate_index_list();
     my $indexes = $self->{'collect_cfg'}->{'indexes'};
@@ -192,7 +168,46 @@
     }
 
+    # check incremental against whether builder can cope or not.
+    if (($self->{'keepold'} || $self->{'incremental'}) && !$self->is_incremental_capable()) {
+	print $outhandle "WARNING: The indexer used is not capable of incremental building. Reverting to -removeold\n";
+	$self->{'keepold'} = 0;
+	$self->{'incremental'} = 0;
+	$self->{'incremental_mode'} = "none";
+    
+    }
+
+
+    # get the list of plugins for this collection
+    my $plugins = [];
+    if (defined $self->{'collect_cfg'}->{'plugin'}) {
+	$plugins = $self->{'collect_cfg'}->{'plugin'};
+    }
+    
+    # load all the plugins
+
+    #build up the extra global options for the plugins
+    my @global_opts = ();
+    if (defined $self->{'collect_cfg'}->{'separate_cjk'} && $self->{'collect_cfg'}->{'separate_cjk'} =~ /^true$/i) {
+	push @global_opts, "-separate_cjk";
+    }
+    $self->{'pluginfo'} = &plugin::load_plugins ($plugins, $self->{'verbosity'}, $outhandle, $failhandle, \@global_opts, $self->{'incremental_mode'});
+   
+    if (scalar(@{$self->{'pluginfo'}}) == 0) {
+	print $outhandle "No plugins were loaded.\n";
+	die "\n";
+    }
+
+    # get the list of classifiers for this collection
+    my $classifiers = [];
+    if (defined $self->{'collect_cfg'}->{'classify'}) {
+	$classifiers = $self->{'collect_cfg'}->{'classify'};
+    }
+
+    # load all the classifiers
+    $self->{'classifiers'} = &classify::load_classifiers ($classifiers, $self->{'build_dir'}, $outhandle);
+
     # load up the document processor for building
     # if a buildproc class has been created for this collection, use it
-    # otherwise, use the mg buildproc
+    # otherwise, use the default buildproc for the builder we are initialising
     my ($buildprocdir, $buildproctype);
     my $collection = $self->{'collection'};
@@ -236,4 +251,13 @@
 }
 
+sub is_incremental_capable
+{
+    # By default we return 'no' as the answer
+    # Safer to assume non-incremental to start with, and then override in
+    # inherited classes that are.
+
+    return 0;
+}
+
 # implement this in subclass if want to do additional initialisation for an
 # incremental build
@@ -386,5 +410,5 @@
     # the fork creates a clone of the *large* process image which (admittedly)
     # is then quickly replaced in the execve() with the much smaller image for 
-    # 'txt2db'.  The trouble is, in that for a seismic second caused by
+    # 'txt2db'.  The trouble is, in that seismic second caused by
     # the fork(), the system really does need to have all that memory available
     # even though it isn't ultimately used.  The result is an out of memory
