Changeset 26324
- Timestamp:
- 2012-10-16T21:12:31+13:00 (12 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/g2f-buildcol.pl
r26322 r26324 208 208 # => Ingest individually! 209 209 210 # set up fedoragsearch for updating the index upon ingesting documents 211 my $fedoragsearch_webapp = &g2futil::gsearch_webapp_folder(); 212 213 # need the username and password preset in order to run fedoraGSearch's RESTClient script 214 # this assumes that the fedoragsearch authentication details are the same as for fedora 215 if (defined $fedoragsearch_webapp) { 216 $ENV{'fgsUserName'} = $options->{'username'}; 217 $ENV{'fgsPassword'} = $options->{'password'}; 218 } 219 210 220 if (opendir(DIR, $export_dir)) { 211 221 closedir DIR; … … 227 237 228 238 if ($dsinfo_status == 0) { 229 print " $pid being updated.\n"; 239 # first remove the doc from the gsearch index before removing it from the fedora repository 240 print " deleting $pid from GSearch index\n"; 241 &g2futil::run_delete_from_index($fedoragsearch_webapp,$pid,$options) if defined $fedoragsearch_webapp; 242 243 print " $pid being updated.\n"; 230 244 &g2futil::run_purge($pid,$options); 231 245 } … … 242 256 print "Ingesting $docmets_filename\n"; 243 257 244 &g2futil::run_ingest($docmets_filename,$options); 258 my $status = &g2futil::run_ingest($docmets_filename,$options); 259 260 # if the document was ingested into Fedora successfully, index it with GSearch next 261 if($status == 0) { 262 if(defined $hash_id) { 263 my $pid = "$pid_namespace:$gs_col-$hash_id"; 264 # now update the fedoragsearch index with the newly ingested document 265 &g2futil::run_update_index($fedoragsearch_webapp,$pid,$options) if defined $fedoragsearch_webapp; 266 } 267 } 268 245 269 print STDERR "</Build>\n" if $gli; 246 270 -
main/trunk/greenstone2/bin/script/g2f-import.pl
r26183 r26324 209 209 print "* Updating existing Greenstone $gs_col objects from Fedora $pid_namespace\n"; 210 210 print "***\n"; 211 212 # set up fedoragsearch for updating the index upon ingesting documents 213 my $fedoragsearch_webapp = &g2futil::gsearch_webapp_folder(); 214 215 # need the username and password preset in order to run fedoraGSearch's RESTClient script 216 # this assumes that the fedoragsearch authentication details are the same as for fedora 217 if (defined $fedoragsearch_webapp) { 218 $ENV{'fgsUserName'} = $options->{'username'}; 219 $ENV{'fgsPassword'} = $options->{'password'}; 220 } 211 221 212 222 # readdir … … 243 253 244 254 if ($dsinfo_status == 0) { 255 # first remove the doc from the gsearch index before removing it from the fedora repository 256 print " deleting $pid from GSearch index\n"; 257 &g2futil::run_delete_from_index($fedoragsearch_webapp,$pid,$options) if defined $fedoragsearch_webapp; 258 245 259 print " $pid being updated.\n"; 246 260 &g2futil::run_purge($pid,$options); -
main/trunk/greenstone2/perllib/g2futil.pm
r24362 r26324 59 59 my $script_ext = ($ENV{'GSDLOS'} =~ m/^windows/) ? ".bat" : ".sh"; 60 60 61 if ($prog =~ m/^fedora-/ ) {61 if ($prog =~ m/^fedora-/ || $prog =~ m/^run[A-Z]*Client/) { # fedora or fedoragsearch script 62 62 $prog .= $script_ext; 63 63 } … … 168 168 return $status; 169 169 } 170 171 # runs fedora gsearch's runRESTClient.sh: updateIndex deletePID <PID> 172 sub 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> 200 sub 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 227 sub 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 170 249 171 250 sub run_ingest
Note:
See TracChangeset
for help on using the changeset viewer.