use of org.apache.solr.client.solrj.response.UpdateResponse in project ddf by codice.
the class BackupCommand method optimizeCollection.
private void optimizeCollection(SolrClient client, String collection) throws IOException, SolrServerException {
LOGGER.debug("Optimization of collection [{}] is in progress.", collection);
printInfoMessage(String.format("Optimizing of collection [%s] is in progress.", collection));
UpdateResponse updateResponse = client.optimize(collection);
LOGGER.debug("Optimization status: {}", updateResponse.getStatus());
if (updateResponse.getStatus() != 0) {
throw new RuntimeException(String.format("Unable to optimize collection [%s].", coreName));
}
}
use of org.apache.solr.client.solrj.response.UpdateResponse in project ddf by codice.
the class SolrClientAdaptorTest method deleteByQuery.
@Test
public void deleteByQuery() throws Exception {
whenSolrClientIsSuccessfullyRetrieved();
UpdateResponse expectedResponse = new UpdateResponse();
when(mockInitializedSolrClientAdaptor.deleteByQuery(TEST_DELETE_BY_QUERY_STRING)).thenReturn(expectedResponse);
UpdateResponse response = solrClientAdaptor.deleteByQuery(TEST_DELETE_BY_QUERY_STRING);
assertThat(response, is(expectedResponse));
verify(mockInitializedSolrClientAdaptor).deleteByQuery(TEST_DELETE_BY_QUERY_STRING);
}
use of org.apache.solr.client.solrj.response.UpdateResponse in project ddf by codice.
the class UninitializedSolrClientAdaptorTest method deleteByQuery.
@Test
public void deleteByQuery() throws Exception {
UpdateResponse response = uninitializedSolrClientAdaptor.deleteByQuery("test-delete-by-query-string");
assertThat(response.getElapsedTime(), is(equalTo(0L)));
assertThat(response.getRequestUrl(), is(equalTo("")));
assertThat(response.getResponse().size(), is(equalTo(0)));
}
use of org.apache.solr.client.solrj.response.UpdateResponse in project ddf by codice.
the class UninitializedSolrClientAdaptor method deleteByQuery.
@Override
public UpdateResponse deleteByQuery(String query) throws SolrServerException, IOException {
LOGGER.debug("Called deleteByQuery on un-initialized SolrClientAdaptor. Ignoring.");
UpdateResponse updateResponse = new UpdateResponse();
updateResponse.setElapsedTime(0);
updateResponse.setRequestUrl("");
updateResponse.setResponse(new NamedList<>());
return updateResponse;
}
use of org.apache.solr.client.solrj.response.UpdateResponse in project ddf by codice.
the class InitializedSolrClientAdaptorTest method deleteByQuery.
@Test
public void deleteByQuery() throws Exception {
UpdateResponse expectedResponse = new UpdateResponse();
when(mockSolrClient.deleteByQuery("")).thenReturn(expectedResponse);
UpdateResponse response = initializedSolrClientAdaptor.deleteByQuery("");
assertThat(response, is(expectedResponse));
verify(mockSolrClient).deleteByQuery("");
}
Aggregations