示例#1
0
 /**
  * Deletes Solr core/index
  *
  * @param String $dataset Dataset/Core/Index name
  * @return void
  * @access private
  */
 public function deleteIndex($dataset)
 {
     //command to delete all documetns of an index
     $removeIndexCommand = "<delete><query>*:*</query></delete>";
     try {
         //create master service
         $transportInstance = new Apache_Solr_HttpTransport_CurlNoReuse();
         $service = new Apache_Solr_Service(SOLR_MASTER_HOST, SOLR_PORT, "/solr/{$dataset}", $transportInstance);
         $service->delete($removeIndexCommand);
         //if master/slave configuration sleep to allow slave to synchronize
         if (defined(SOLR_SLAVE_HOST)) {
             sleep(100);
         }
         $this->unloadCore($dataset);
     } catch (Exception $e) {
         throw new Exception($e);
     }
 }