Changeset 25892
- Timestamp:
- 2012-07-03T19:53:05+12:00 (11 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java
r25886 r25892 74 74 75 75 String solr_home_str = GSFile.extHome(gsdl3_home, solr_ext_name); 76 File solr_home = new File(solr_home_str); 77 File solr_xml = new File(solr_home, "solr.xml"); 78 79 all_solr_cores = new CoreContainer(solr_home_str, solr_xml); 76 77 all_solr_cores = new CoreContainer(solr_home_str); 80 78 } 81 79 catch (Exception e) … … 91 89 public boolean configure(Element info, Element extra_info) 92 90 { 93 if (!super.configure(info, extra_info)) 94 { 95 return false; 96 } 97 91 boolean success = super.configure(info, extra_info); 92 93 // 1. Make the CoreContainer reload solr.xml 94 // This is particularly needed for when activate.pl is executed during 95 // a running GS3 server. At that point, the solr collection is reactivated and 96 // we need to tell Greenstone that the solr index has changed. This requires 97 // the CoreContainer to reload the solr.xml file, and it all works again. 98 99 solr_core_cache.clear(); // clear the map of existing solr cores 100 101 // Reload the updated solr.xml into the CoreContainer 102 // (Doing an all_solr_cores.shutdown() first doesn't seem to be required) 103 try { 104 String solr_home_str = all_solr_cores.getSolrHome(); 105 File solr_home = new File(solr_home_str); 106 File solr_xml = new File( solr_home,"solr.xml" ); 107 108 all_solr_cores.load(solr_home_str,solr_xml); 109 } catch (Exception e) { 110 logger.error("Exception in GS2SolrSearch.configure(): " + e.getMessage()); 111 e.printStackTrace(); 112 return false; 113 } 114 115 if(!success) { 116 return false; 117 } 118 119 // 2. Setting up facets 98 120 Element searchElem = (Element) GSXML.getChildByTagName(extra_info, GSXML.SEARCH_ELEM); 99 121 NodeList configIndexElems = searchElem.getElementsByTagName(GSXML.INDEX_ELEM); -
main/trunk/greenstone2/bin/script/activate.pl
r25889 r25892 430 430 my $build_dir = undef; 431 431 my $index_dir = undef; 432 432 my $site = undef; 433 433 434 434 my $removeold = 0; 435 435 my $keepold = 0; 436 436 my $incremental = 0; # used by solr 437 437 438 my $library_url = undef; # to be specified on the cmdline if not using a GS-included web server 438 439 … … 455 456 elsif ($arg eq "-keepold") { 456 457 $keepold = 1; 458 } 459 elsif ($arg eq "-incremental") { 460 $incremental = 1; 457 461 } 458 462 elsif ($arg eq "-library_url") { … … 595 599 # If keepold: move building's contents into index, where only duplicates will get deleted. 596 600 # removeold and keepold can't both be on at the same time 597 ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($removeold, $keepold, 598 0, # incremental is irrelevant to what activate.pl does, setting this = 0 601 # incremental becomes relevant for solr, though it was irrelevant to what activate.pl does (moving building to index) 602 my $incremental_mode; 603 ($removeold, $keepold, $incremental, $incremental_mode) = &scriptutil::check_removeold_and_keepold($removeold, $keepold, 604 $incremental, 599 605 $build_dir, # checkdir. Usually archives or export to be deleted. activate.pl deletes building 600 606 $collectcfg); … … 639 645 } 640 646 } 641 elsif ($keepold ) {642 if ($buildtype eq "solr") { ### no building- prefix for keepold incremental case?647 elsif ($keepold || $incremental) { 648 if ($buildtype eq "solr") { 643 649 # if solr, remove any cores that may be using the building_dir before moving this dir onto index 644 650 foreach my $corename (@corenames) { … … 652 658 &util::mv_dir_contents($build_dir, $index_dir); 653 659 } 654 660 655 661 if ($buildtype eq "solr") { 656 # Call CREATE action to get all cores pointing to the index folder, since building is now index 657 ### Should already be using the index_dir directory for $keepold (incremental) case? Then call RELOAD CORE 662 # Call CREATE action to get the old cores pointing to the index folder 658 663 foreach my $corename (@corenames) { 659 664 if($removeold) { 665 # Call CREATE action to get all cores pointing to the index folder, since building is now index 660 666 $solr_server->admin_create_core($corename, $index_dir); 661 } elsif ($keepold) { 662 $solr_server->admin_reload_core($corename); 667 668 } elsif ($keepold || $incremental) { 669 # Call RELOAD core. Should already be using the index_dir directory for $keepold and $incremental case 670 671 # Ping to see if corename exists, if it does, reload, else create 672 if ($solr_server->admin_ping_core($corename)) { 673 $solr_server->admin_reload_core($corename); 674 } else { 675 $solr_server->admin_create_core($corename, $index_dir); 676 } 663 677 } 664 678 }
Note:
See TracChangeset
for help on using the changeset viewer.