Show
Ignore:
Timestamp:
16.10.2012 21:12:31 (7 years ago)
Author:
ak19
Message:

1. When purging documents from the fedora repository during import and buildcol, these documents are also removed from the Fedora GSearch index. Likewise, when documents are ingested into the Fedora repository during buildcol, these documents are also indexed by Fedora GSearch. 2. Added methods in g2futil.pm to be able to do this

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/g2futil.pm

    r24362 r26324  
    5959    my $script_ext = ($ENV{'GSDLOS'} =~ m/^windows/) ? ".bat" : ".sh"; 
    6060 
    61     if ($prog =~ m/^fedora-/) { 
     61    if ($prog =~ m/^fedora-/ || $prog =~ m/^run[A-Z]*Client/) { # fedora or fedoragsearch script 
    6262    $prog .= $script_ext; 
    6363    } 
     
    168168    return $status; 
    169169} 
     170 
     171# runs fedora gsearch's runRESTClient.sh: updateIndex deletePID <PID> 
     172sub run_delete_from_index 
     173{ 
     174    my ($fedoragsearch_webapp,$pid,$options) = @_; 
     175 
     176    my $verbosity = $options->{'verbosity'}; 
     177 
     178    my $hostname = $options->{'hostname'}; 
     179    my $port     = $options->{'port'}; 
     180    my $username = $options->{'username'}; 
     181    my $password = $options->{'password'}; 
     182    my $protocol = $options->{'protocol'}; 
     183 
     184    my $server = "$hostname:$port"; 
     185    #$ENV{'fgsUserName'} = $options->{'username'}; 
     186    #$ENV{'fgsPassword'} = $options->{'password'};     
     187 
     188    #my $prog = &util::filename_cat($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh"); 
     189    my $prog = &util::filename_cat($fedoragsearch_webapp, "client", "runRESTClient.sh"); 
     190 
     191    my $gsearch_commands = "updateIndex deletePID"; 
     192    my $arguments = "$server $gsearch_commands $pid";     
     193 
     194    my $status = run_cmd($prog,$arguments,$verbosity); 
     195 
     196    return $status; 
     197} 
     198 
     199# runs fedora gsearch's runRESTClient.sh: updateIndex fromPID <PID> 
     200sub run_update_index 
     201{ 
     202    my ($fedoragsearch_webapp,$pid,$options) = @_; 
     203 
     204    my $verbosity = $options->{'verbosity'}; 
     205 
     206    my $hostname = $options->{'hostname'}; 
     207    my $port     = $options->{'port'}; 
     208    my $username = $options->{'username'}; 
     209    my $password = $options->{'password'}; 
     210    my $protocol = $options->{'protocol'}; 
     211 
     212    my $server = "$hostname:$port"; 
     213    #$ENV{'fgsUserName'} = $options->{'username'}; 
     214    #$ENV{'fgsPassword'} = $options->{'password'};     
     215 
     216    #my $prog = &util::filename_cat($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh"); 
     217    my $prog = &util::filename_cat($fedoragsearch_webapp, "client", "runRESTClient.sh"); 
     218     
     219    my $gsearch_commands = "updateIndex fromPID"; 
     220    my $arguments = "$server $gsearch_commands $pid";     
     221 
     222    my $status = run_cmd($prog,$arguments,$verbosity); 
     223 
     224    return $status; 
     225} 
     226 
     227sub gsearch_webapp_folder 
     228{    
     229    my $fedoragsearch_webapp = undef; 
     230     
     231    # if GS3, first look for a fedoragsearch webapp installed in Greenstone's tomcat 
     232    if(defined $ENV{'GSDL3SRCHOME'}) { 
     233    $fedoragsearch_webapp = &util::filename_cat($ENV{'GSDL3SRCHOME'},"packages","tomcat","webapps","fedoragsearch");     
     234    return $fedoragsearch_webapp if (&util::dir_exists($fedoragsearch_webapp)); 
     235    } 
     236 
     237    # next look for a fedoragsearch webapp installed in Fedora's tomcat 
     238    if(defined $ENV{'FEDORA_HOME'}) { 
     239    $fedoragsearch_webapp =  &util::filename_cat($ENV{'FEDORA_HOME'},"tomcat","webapps","fedoragsearch"); 
     240    return $fedoragsearch_webapp if (&util::dir_exists($fedoragsearch_webapp)); 
     241    } 
     242 
     243    ## check for a user-defined $ENV{'FEDORA_GSEARCH'} variable first, which points to a gsearch webapp folder?? 
     244 
     245    # assume no fedoragsearch 
     246    return $fedoragsearch_webapp; # undef 
     247} 
     248 
    170249 
    171250sub run_ingest