Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-1222 add convenience methods for deleteById to take a list of strings

Noble Paul7e5cd7b14782
diff --git a/src/solrj/org/apache/solr/client/solrj/SolrServer.java b/src/solrj/org/apache/solr/client/solrj/SolrServer.java
index b661d651977..b556e10e40d 100644
--- a/src/solrj/org/apache/solr/client/solrj/SolrServer.java
+++ b/src/solrj/org/apache/solr/client/solrj/SolrServer.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.Collection;
import java.util.ArrayList;
+import java.util.List;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.SolrPing;
@@ -101,6 +102,10 @@ public abstract class SolrServer implements Serializable
return new UpdateRequest().deleteById( id ).process( this );
}
+ public UpdateResponse deleteById(List<String> ids) throws SolrServerException, IOException {
+ return new UpdateRequest().deleteById( ids ).process( this );
+ }
+
public UpdateResponse deleteByQuery(String query) throws SolrServerException, IOException {
return new UpdateRequest().deleteByQuery( query ).process( this );
}
diff --git a/src/solrj/org/apache/solr/client/solrj/request/UpdateRequest.java b/src/solrj/org/apache/solr/client/solrj/request/UpdateRequest.java
index a1af0b9775b..e9322c242f6 100644
--- a/src/solrj/org/apache/solr/client/solrj/request/UpdateRequest.java
+++ b/src/solrj/org/apache/solr/client/solrj/request/UpdateRequest.java
@@ -113,6 +113,13 @@ public class UpdateRequest extends SolrRequest
deleteById.add( id );
return this;
}
+ public UpdateRequest deleteById( List<String> ids )
+ {
+ if( deleteById == null ) {
+ deleteById = new ArrayList<String>(ids);
+ }
+ return this;
+ }
public UpdateRequest deleteByQuery( String q )
{