Skip to content

Apache Lucene open-source search software

adding a clear() function to the solrj UpdateRequest

Ryan McKinley0994528c2167
diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/request/UpdateRequest.java b/client/java/solrj/src/org/apache/solr/client/solrj/request/UpdateRequest.java
index c3392172f59..a65747babae 100644
--- a/client/java/solrj/src/org/apache/solr/client/solrj/request/UpdateRequest.java
+++ b/client/java/solrj/src/org/apache/solr/client/solrj/request/UpdateRequest.java
@@ -66,6 +66,25 @@ public class UpdateRequest extends RequestBase
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
+ /**
+ * clear the pending documents and delete commands
+ */
+ public void clear()
+ {
+ if( documents != null ) {
+ documents.clear();
+ }
+ if( deleteById != null ) {
+ deleteById.clear();
+ }
+ if( deleteQuery != null ) {
+ deleteQuery.clear();
+ }
+ }
+
+ //---------------------------------------------------------------------------
+ //---------------------------------------------------------------------------
+
public UpdateRequest add( final SolrInputDocument doc )
{
if( documents == null ) {