From 7e5cd7b14782412220588dd27a57b1d3caaf3e8a Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Fri, 19 Jun 2009 11:54:44 +0000 Subject: [PATCH] SOLR-1222 add convenience methods for deleteById to take a list of strings git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@786465 13f79535-47bb-0310-9956-ffa450edef68 --- src/solrj/org/apache/solr/client/solrj/SolrServer.java | 5 +++++ .../apache/solr/client/solrj/request/UpdateRequest.java | 7 +++++++ 2 files changed, 12 insertions(+) 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 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 ids ) + { + if( deleteById == null ) { + deleteById = new ArrayList(ids); + } + return this; + } public UpdateRequest deleteByQuery( String q ) {