r8206@llin: dpavlin | 2005-09-23 10:53:58 +0200
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Fri, 23 Sep 2005 08:54:11 +0000 (08:54 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Fri, 23 Sep 2005 08:54:11 +0000 (08:54 +0000)
 Added option -j which allow faster initial creation of full-text index from
 existing database because it doesn't check if files allready exists in
 full-text index.

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@131 8392b6e1-25fa-0310-8288-cc32f8e212ea

Makefile
bin/BackupPC_updatedb

index 09d5f57..a57ae08 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@ update:
 
 index: test
        sudo rm -Rf /data/backuppc/data/casket || true
-       sudo -u backuppc /data/backuppc/bin/BackupPC_updatedb -i
+       sudo -u backuppc /data/backuppc/bin/BackupPC_updatedb -j
 
 xls: test
        sudo -u backuppc /data/backuppc/bin/BackupPC_xls_report
@@ -53,13 +53,8 @@ profile: test
        createdb $(db)
        date > $(profile_file)
        echo "## NORMAL RUN" >> $(profile_file)
-       sudo rm -Rf /data/backuppc/data/casket || true
-       estcall raw -auth admin admin 'http://localhost:1978/master?action=nodedel&name=backuppc' || true
-       estcall raw -auth admin admin 'http://localhost:1978/master?action=nodeadd&name=backuppc&label=BackupPC%20search%20index'
        sudo -u backuppc /data/backuppc/bin/BackupPC_updatedb -c $(profile_opt) | tee -a $(profile_file)
        echo "## DProf RUN" >> $(profile_file)
-       sudo rm -Rf /data/backuppc/data/casket || true
-       estcall raw -auth admin admin 'http://localhost:1978/master?action=nodeadd&name=backuppc&label=BackupPC%20search%20index'
        sudo -u backuppc perl -d:DProf /data/backuppc/bin/BackupPC_updatedb -d $(profile_opt)
        dprofpp 2>&1 | tee -a $(profile_file)
        echo "## DBI_PROFILE RUN" >> $(profile_file)
index f2a825e..74b7efa 100755 (executable)
@@ -50,7 +50,7 @@ my $dbh = DBI->connect($dsn, $user, "", { RaiseError => 1, AutoCommit => 0 });
 
 my %opt;
 
-if ( !getopts("cdm:v:i", \%opt ) ) {
+if ( !getopts("cdm:v:ij", \%opt ) ) {
        print STDERR <<EOF;
 usage: $0 [-c|-d] [-m num] [-v|-v level] [-i]
 
@@ -59,7 +59,12 @@ Options:
        -d      delete database before import
        -m num  import just num increments for one host
        -v num  set verbosity (debug) level (default $debug)
-       -i      update HyperEstraier full text index
+       -i      update Hyper Estraier full text index
+       -j      update full text, don't check existing files
+
+Option -j is variation on -i. It will allow faster initial creation
+of full-text index from existing database.
+
 EOF
        exit 1;
 }
@@ -104,6 +109,8 @@ sub hest_update {
 
        my ($host_id, $share_id, $num) = @_;
 
+       my $skip_check = $opt{j} && print STDERR "Skipping check for existing files -- this should be used only with initital import\n";
+
        unless ($use_hest) {
                print STDERR "HyperEstraier support not enabled in configuration\n";
                return;
@@ -190,8 +197,10 @@ sub hest_update {
                        my $fid = $row->{'fid'} || die "no fid?";
                        my $uri = 'file:///' . $fid;
 
-                       my $id = ($hest_db || $hest_node)->uri_to_id($uri);
-                       next unless ($id == -1);
+                       unless ($skip_check) {
+                               my $id = ($hest_db || $hest_node)->uri_to_id($uri);
+                               next unless ($id == -1);
+                       }
 
                        # create a document object 
                        my $doc = HyperEstraier::Document->new;
@@ -247,11 +256,12 @@ sub hest_update {
 
 
 ## update index ##
-if (($opt{i} || ($index_path && ! -e $index_path)) && !$opt{c}) {
+if (($opt{i} || $opt{j} || ($index_path && ! -e $index_path)) && !$opt{c}) {
        # update all
        print "force update of HyperEstraier index ";
        print "importing existing data" unless (-e $index_path);
        print "by -i flag" if ($opt{i});
+       print "by -j flag" if ($opt{j});
        print "\n";
        hest_update();
 }