Changeset 25888 for main/trunk/greenstone2/bin/script/activate.pl
- Timestamp:
- 2012-06-28T18:54:11+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/activate.pl
r25887 r25888 520 520 $buildtype = "mg"; #mg is the default 521 521 } 522 523 my $solr_server; 524 my @corenames = (); 525 if($buildtype eq "solr") { # start up the jetty server 526 my $solr_ext = $ENV{'GEXT_SOLR'}; # from solr_passes.pl 527 unshift (@INC, "$solr_ext/perllib"); 528 require solrserver; 529 530 # Solr cores are named without taking the collection-group name into account, since solr 531 # is used for GS3 and GS3 doesn't use collection groups but has the site concept instead 532 my ($colname, $colgroup) = &util::get_collection_parts($qualified_collection); 533 534 # See solrbuilder.pm to get the indexing levels (document, section) from the collectcfg file 535 # Used to generate core names from them and remove cores by name 536 foreach my $level ( @{$collectcfg->{'levels'}} ){ 537 my ($pindex) = $level =~ /^(.)/; 538 my $indexname = $pindex."idx"; 539 push(@corenames, "$site-$colname-$indexname"); #"$site-$colname-didx", "$site-$colname-sidx" 540 } 541 542 # If the Solr/Jetty server is not already running, the following starts 543 # it up, and only returns when the server is "reading and listening" 544 $solr_server = new solrserver($build_dir); 545 $solr_server->start(); 546 547 # We'll be moving building to index. For solr collection, there's further 548 # special processing to make a corresponding change to the solr.xml 549 # by removing the temporary building cores and (re)creating the index cores 550 } 522 551 523 552 # Now the logic in GLI's CollectionManager.java (processComplete() … … 572 601 573 602 if($removeold) { 603 604 if ($buildtype eq "solr") { 605 # if solr, remove any cores using the index_dir before deleting this dir 606 foreach my $corename (@corenames) { 607 $solr_server->admin_unload_core($corename); 608 } 609 } 574 610 575 611 if(&util::dir_exists($index_dir)) { … … 596 632 } 597 633 elsif ($keepold) { 634 if ($buildtype eq "solr") { 635 # if solr, remove any cores using the index_dir before deleting this dir 636 foreach my $corename (@corenames) { 637 $solr_server->admin_unload_core($corename); 638 } 639 } 640 598 641 # Copy just the contents of building dir into the index dir, overwriting 599 642 # existing files, but don't replace index with building. … … 602 645 } 603 646 647 if ($buildtype eq "solr") { 648 # Call CREATE action to get the old cores pointing to the index folder 649 foreach my $corename (@corenames) { 650 $solr_server->admin_create_core($corename, $index_dir); 651 } 652 653 # copy the just updated ext/solr/solr.xml to web/ext/solr/solr.xml 654 $solr_server->copy_solrxml_to_web(); 655 } 656 604 657 # 4. Ping the library URL, and if it's a persistent server and running, activate the collection again 605 658 … … 643 696 644 697 &print_msg("\n"); 698 699 if($buildtype eq "solr") { 700 if ($solr_server->explicitly_started()) { 701 $solr_server->stop(); 702 } 703 } 645 704 } 646 705
Note:
See TracChangeset
for help on using the changeset viewer.