Changeset 33306 for gs3-extensions

Show
Ignore:
Timestamp:
08.07.2019 13:59:12 (4 months ago)
Author:
kjdon
Message:

we need to use (the new) level_ids list to determine which cores we are using, not just assume didx and sidx. This class was adding in an sidx when one wasn't needed, and then it would never get deleted

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/src/java/org/greenstone/gsdl3/service/GS2SolrSearch.java

    r32636 r33306  
    571571        solrServer.setConnectionTimeout(3000); 
    572572        //Cores 
    573         String coreSecName = getCollectionCoreNamePrefix() + "-sidx"; 
    574         String coreDocName = getCollectionCoreNamePrefix() + "-didx"; 
    575  
    576  
    577         if (!checkSolrCore(coreSecName, solrServer)){ 
    578             if (!activateSolrCore(coreSecName, solrServer)){ 
    579                 logger.error("Couldn't activate Solr core " + coreSecName + " for collection " + cluster_name); 
    580                 return false; 
    581             } 
    582         } 
    583         if (!checkSolrCore(coreDocName, solrServer)){ 
    584             if (!activateSolrCore(coreDocName, solrServer)){ 
    585                 logger.error("Couldn't activate Solr core " + coreDocName + " for collection " + cluster_name); 
    586                 return false; 
    587             } 
    588         } 
     573        // check level_ids to see which cores we have 
     574        for (int i=0; i<level_ids.size(); i++) { 
     575          String level = level_ids.get(i); 
     576          if (level.toUpperCase().equals("SEC")) { 
     577            String coreSecName = getCollectionCoreNamePrefix() + "-sidx"; 
     578            if (!checkSolrCore(coreSecName, solrServer)){ 
     579              if (!activateSolrCore(coreSecName, solrServer)){ 
     580            logger.error("Couldn't activate Solr core " + coreSecName + " for collection " + cluster_name); 
     581            return false; 
     582              } 
     583            } 
     584          } 
     585          else if (level.toUpperCase().equals("DOC")){ 
     586            String coreDocName = getCollectionCoreNamePrefix() + "-didx"; 
     587            if (!checkSolrCore(coreDocName, solrServer)){ 
     588              if (!activateSolrCore(coreDocName, solrServer)){ 
     589            logger.error("Couldn't activate Solr core " + coreDocName + " for collection " + cluster_name); 
     590            return false; 
     591              } 
     592            } 
     593          } 
     594        } // for each level 
    589595        return true; 
    590596    }