List of usage examples for org.apache.solr.client.solrj SolrClient deleteByQuery
public UpdateResponse deleteByQuery(String query, int commitWithinMs) throws SolrServerException, IOException
From source file:net.yacy.cora.federate.solr.instance.ServerShard.java
License:Open Source License
/** * Deletes documents from the index based on a query, specifying max time before commit * @param query the query expressing what documents to delete * @param commitWithinMs max time (in ms) before a commit will happen * @throws IOException If there is a low-level I/O error. * @since 3.6//from ww w . j a va 2 s .c o m */ @Override public UpdateResponse deleteByQuery(String query, int commitWithinMs) throws SolrServerException, IOException { if (!this.writeEnabled) return _dummyOKResponse; UpdateResponse ur = null; for (SolrClient s : this.shards.server4read()) ur = s.deleteByQuery(query, commitWithinMs); return ur; }
From source file:org.roda.core.index.utils.SolrUtils.java
public static <T extends IsIndexed> void delete(SolrClient index, Class<T> classToDelete, Filter filter) throws GenericException, RequestNotValidException { try {// ww w. j a v a2 s.c o m index.deleteByQuery(getIndexName(classToDelete).get(0), parseFilter(filter)); } catch (SolrServerException | IOException e) { throw new GenericException("Could not delete items", e); } }