Example usage for org.apache.solr.client.solrj SolrClient deleteById

List of usage examples for org.apache.solr.client.solrj SolrClient deleteById

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj SolrClient deleteById.

Prototype

public UpdateResponse deleteById(List<String> ids, int commitWithinMs) throws SolrServerException, IOException 

Source Link

Document

Deletes a list of documents by unique ID, specifying max time before commit.

Usage

From source file:net.yacy.cora.federate.solr.instance.ServerShard.java

License:Open Source License

/**
 * Deletes a single document by unique ID, specifying max time before commit
 * @param id  the ID of the document 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// w  w  w.j  a v a 2 s.  com
 */
@Override
public UpdateResponse deleteById(String id, int commitWithinMs) throws SolrServerException, IOException {
    if (!this.writeEnabled)
        return _dummyOKResponse;
    UpdateResponse ur = null;
    for (SolrClient s : this.shards.server4read())
        ur = s.deleteById(id, commitWithinMs);
    return ur;
}

From source file:net.yacy.cora.federate.solr.instance.ServerShard.java

License:Open Source License

/**
 * Deletes a list of documents by unique ID, specifying max time before commit
 * @param ids  the list of document IDs 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 w  ww. ja  v  a 2  s . c om
 */
@Override
public UpdateResponse deleteById(List<String> ids, int commitWithinMs) throws SolrServerException, IOException {
    if (!this.writeEnabled)
        return _dummyOKResponse;
    UpdateResponse ur = null;
    for (SolrClient s : this.shards.server4read())
        ur = s.deleteById(ids, 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, List<String> ids)
        throws GenericException {
    try {//from   w  w  w .ja  v  a 2 s . c  o  m
        index.deleteById(getIndexName(classToDelete).get(0), ids);
    } catch (SolrServerException | IOException e) {
        throw new GenericException("Could not delete items", e);
    }
}