| 200 | } |
| 201 | |
| 202 | protected void deleteCore(CommandLine cli, SolrClient solrClient) throws Exception { |
| 203 | String coreName = cli.getOptionValue(COLLECTION_NAME_OPTION); |
| 204 | |
| 205 | echo("\nDeleting core '" + coreName + "' using V2 Cores API\n"); |
| 206 | |
| 207 | try { |
| 208 | var req = new CoresApi.UnloadCore(coreName); |
| 209 | req.setDeleteIndex(true); |
| 210 | req.setDeleteDataDir(true); |
| 211 | req.setDeleteInstanceDir(true); |
| 212 | var response = req.process(solrClient); |
| 213 | echoIfVerbose(response); |
| 214 | } catch (SolrServerException sse) { |
| 215 | throw new Exception("Failed to delete core '" + coreName + "' due to: " + sse.getMessage()); |
| 216 | } |
| 217 | } |
| 218 | } |