+B<this command will probably go away. Don't get used to it!>
+
+=head1 OPTIONS
+
+=over 4
+
+=item --offset 42
+
+start loading (all) databases at offset 42
+
+=item --limit 100
+
+limit loading to 100 records
+
+=item --clean
+
+remove database and Hyper Estraier index before indexing
+
+=item --only=database_name/input_filter
+
+reindex just single database (legacy name is --one)
+
+C</input_filter> is optional part which can be C<name>
+or C<type> from input
+
+=item --config conf/config.yml
+
+path to YAML configuration file
+
+=item --stats
+
+disable indexing, modify_* in configuration and dump statistics about field
+and subfield usage for each input
+
+=item --validate path/to/validation_file
+
+turn on extra validation of imput records, see L<WebPAC::Validation>
+
+=item --validate-delimiters path/to/validate_delimiters_file
+
+this option is used with C<--validate> to turn on extra validation of
+delimiters. If file is non existant, it will be created on first run.
+
+=item --marc-generate
+
+Generate MARC file. This will automatically be on if file contains C<marc*> directives.
+You can use this option as C<--no-marc-generate> to disable MARC generation.
+
+=item --marc-lint
+
+By default turned on if normalisation file has C<marc*> directives. You can disable lint
+messages with C<--no-marc-lint>.
+
+=item --marc-dump
+
+Force dump or input and marc record for debugging.
+
+=item --parallel 4
+
+Run databases in parallel (aproximatly same as number of processors in
+machine if you want to use full load)
+
+=item --only-links
+
+Create just links
+
+=item --merge
+
+Create merged index of databases which have links
+
+=back
+
+=cut
+
+my $offset;
+my $limit;
+
+my $clean = 0;
+my $config_path;
+my $debug = 0;
+my $only_filter;
+my $stats = 0;
+my $validate_path;
+my $validate_delimiters_path;
+my $marc_generate = 1;
+my $marc_lint = 1;
+my $marc_dump = 0;
+my $parallel = 0;
+my $only_links = 0;
+my $merge = 0;
+my $help;
+
+my $log = _new WebPAC::Common()->_get_logger();
+
+GetOptions(
+ "limit=i" => \$limit,
+ "offset=i" => \$offset,
+ "clean" => \$clean,
+ "one=s" => \$only_filter,
+ "only=s" => \$only_filter,
+ "config" => \$config_path,
+ "debug+" => \$debug,
+ "stats" => \$stats,
+ "validate=s" => \$validate_path,
+ "validate-delimiters=s" => \$validate_delimiters_path,
+ "marc-generate!" => \$marc_generate,
+ "marc-lint!" => \$marc_lint,
+ "marc-dump!" => \$marc_dump,
+ "parallel=i" => \$parallel,
+ "only-links!" => \$only_links,
+ "merge" => \$merge,
+ "help" => \$help,
+);
+
+pod2usage(-verbose => 2) if ($help);
+
+my $config = new WebPAC::Config( path => $config_path );
+
+#print "config = ",dump($config) if ($debug);
+
+die "no databases in config file!\n" unless ($config->databases);
+
+$log->info( "-" x 79 );
+
+my $log_file = 'log';
+
+if (-e $log_file ) { # && -s $log_file > 5 * 1024 * 1024) {
+ $log->info("moved old log with ", -s $log_file, " bytes to '${log_file}.old'");
+ rename $log_file, "${log_file}.old" || $log->logwarn("can't rename $log_file to ${log_file}.old: $!");
+}
+
+my $estcmd_fh;
+my $estcmd_path = './estcmd-merge.sh';
+if ($merge) {
+ open($estcmd_fh, '>', $estcmd_path) || $log->logdie("can't open $estcmd_path: $!");
+ print $estcmd_fh 'cd /data/estraier/_node/ || exit 1',$/;
+ print $estcmd_fh 'sudo /etc/init.d/hyperestraier stop',$/;
+ $log->info("created merge batch file $estcmd_path");
+}
+
+my $validate;
+$validate = new WebPAC::Validate(
+ path => $validate_path,
+ delimiters => $config->webpac('delimiters'),
+ delimiters_path => $validate_delimiters_path,
+) if ($validate_path || $validate_delimiters_path);
+
+my $use_indexer = $config->use_indexer;
+$stats ||= $validate;
+if ($stats) {
+ $log->debug("disabled indexing for stats collection");
+ $use_indexer = undef;
+} else {
+ $log->info("using $use_indexer indexing engine...");
+}
+
+# parse normalize files and create source files for lookup and normalization
+
+my $parser = new WebPAC::Parser( config => $config );