/** * Delete a record from the database. * * @param table * The name of the table * @param key * The record key of the record to delete. * @return Zero on success, a non-zero error code on error. See this class's description for a * discussion of error codes. */ @Override public Status delete(String table, String key) { try { UpdateResponse response; if (batchMode) { response = client.deleteById(table, key, commitTime); } else { response = client.deleteById(table, key); client.commit(table); } return checkStatus(response.getStatus()); } catch (IOException | SolrServerException e) { e.printStackTrace(); } return Status.ERROR; }
/** * Delete a record from the database. * * @param table * The name of the table * @param key * The record key of the record to delete. * @return Zero on success, a non-zero error code on error. See this class's description for a * discussion of error codes. */ @Override public Status delete(String table, String key) { try { UpdateResponse response; if (batchMode) { response = client.deleteById(table, key, commitTime); } else { response = client.deleteById(table, key); client.commit(table); } return checkStatus(response.getStatus()); } catch (IOException | SolrServerException e) { e.printStackTrace(); } return Status.ERROR; }
/** * Deletes a list of documents by unique ID * * @param ids the list of document IDs to delete; must be non-null and contain elements * * @return an {@link org.apache.solr.client.solrj.response.UpdateResponse} containing the response * from the server * * @throws IOException If there is a low-level I/O error. * @throws SolrServerException if there is an error on the server */ public UpdateResponse deleteById(List<String> ids) throws SolrServerException, IOException { return deleteById(null, ids); }
/** * Deletes a single document by unique ID * * @param id the ID of the document to delete * * @return an {@link org.apache.solr.client.solrj.response.UpdateResponse} containing the response * from the server * * @throws IOException If there is a low-level I/O error. * @throws SolrServerException if there is an error on the server */ public UpdateResponse deleteById(String id) throws SolrServerException, IOException { return deleteById(null, id); }
/** * Deletes a single document by unique ID * * @param id the ID of the document to delete * * @return an {@link org.apache.solr.client.solrj.response.UpdateResponse} containing the response * from the server * * @throws IOException If there is a low-level I/O error. * @throws SolrServerException if there is an error on the server */ public UpdateResponse deleteById(String id) throws SolrServerException, IOException { return deleteById(null, id); }
@Override public void delete(List<String> ids) throws SolrServerException, IOException { this.logger.debug("Delete Solr documents [{}] from index", ids); this.server.deleteById(ids); }
@Override public void delete(String id) throws SolrServerException, IOException { this.logger.debug("Delete Solr document [{}] from index", id); this.server.deleteById(id); }
@Override protected void deleteDocument(SearchDocument doc) throws IOException { try { client.deleteById(doc.getId()); } catch (SolrServerException e) { throw new IOException(e); } }
protected void removePage(String id, SolrClient solr) { try { LOG.info("Removing page " + id); solr.deleteById(id); solr.commit(); } catch (Exception e) { LOG.error("Failure to remove page " + id, e); } }
@Override public UpdateResponse deleteByIds(String collection, Collection<String> ids) { Assert.notNull(ids, "Cannot delete 'null' collection."); return execute(solrClient -> solrClient.deleteById(collection, ids.stream().collect(Collectors.toList()))); }
@Override public UpdateResponse deleteByIds(String collection, String id) { Assert.notNull(id, "Cannot delete 'null' id."); return execute(solrClient -> solrClient.deleteById(collection, id)); }
@Override protected void deleteDocument(SearchDocument doc) throws IOException { try { client.deleteById(doc.getId()); } catch (SolrServerException e) { throw new IOException(e); } }
@Override public void remove(String id) { try { solr.deleteById(id); solr.commit(); } catch (Exception e) { logger.error("Solr remove error.", e); } }
@Override public void remove(String collectionName, Record record, boolean asynchronous) throws DatastoreClientServiceException { try { solr.deleteById(collectionName, record.getId()); } catch (SolrServerException | IOException e) { logger.error(e.toString()); throw new DatastoreClientServiceException(e); } }
@Override public void remove(String collectionName, Record record, boolean asynchronous) throws DatastoreClientServiceException { try { getClient().deleteById(collectionName, record.getId()); } catch (SolrServerException | IOException e) { logger.error(e.toString()); throw new DatastoreClientServiceException(e); } } }
private void retryDeletesIndividually(int shard, List<String> idsToDelete) throws SolrServerException, IOException { for (String idToDelete : idsToDelete) { try { solrServers.get(shard).deleteById(idToDelete); indexDeleteMeter.mark(); } catch (SolrException e) { logOrThrowSolrException(e); // No exception thrown through, so we can update the metric documentDeleteErrorMeter.mark(); } } }
private void retryDeletesIndividually(int shard, List<String> idsToDelete) throws SolrServerException, IOException { for (String idToDelete : idsToDelete) { try { solrServers.get(shard).deleteById(idToDelete); indexDeleteMeter.mark(); } catch (SolrException e) { logOrThrowSolrException(e); // No exception thrown through, so we can update the metric documentDeleteErrorMeter.mark(); } } }
private void retryDeletesIndividually(List<String> idsToDelete) throws SolrServerException, IOException { for (String idToDelete : idsToDelete) { try { solrServer.deleteById(idToDelete); indexDeleteMeter.mark(); } catch (SolrException e) { logOrThrowSolrException(e); // No exception thrown through, so we can update the metric documentDeleteErrorMeter.mark(); } } }
private void retryDeletesIndividually(List<String> idsToDelete) throws SolrServerException, IOException { for (String idToDelete : idsToDelete) { try { solrServer.deleteById(idToDelete); indexDeleteMeter.mark(); } catch (SolrException e) { logOrThrowSolrException(e); // No exception thrown through, so we can update the metric documentDeleteErrorMeter.mark(); } } }
private void delete(String collection, List<String> variants) throws IOException, SolrServerException { if (CollectionUtils.isNotEmpty(variants)) { UpdateResponse updateResponse = solrManager.getSolrClient().deleteById(collection, variants); if (updateResponse.getStatus() == 0) { solrManager.getSolrClient().commit(collection); } } }