Apache Solr open-source search software
SOLR-3649: fix bug in JavabinLoader that caused deleteById(List<String> ids) to not work in SolrJ
Sami Siren1d27c0364b69
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 5bab622d322..e337b0874ea 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -51,6 +51,9 @@ Bug Fixes* SOLR-3725: Fixed package-local-src-tgz target to not bring in unnecessary jarsand binary contents. (Michael Dodsworth via rmuir)+* SOLR-3649: Fixed bug in JavabinLoader that caused deleteById(List<String> ids)+ to not work in SolrJ (siren)+================== 4.0.0-BETA ===================diff --git a/solr/core/src/java/org/apache/solr/handler/loader/JavabinLoader.java b/solr/core/src/java/org/apache/solr/handler/loader/JavabinLoader.javaindex ec28eb0da6e..09014f3855c 100644--- a/solr/core/src/java/org/apache/solr/handler/loader/JavabinLoader.java+++ b/solr/core/src/java/org/apache/solr/handler/loader/JavabinLoader.java@@ -122,8 +122,8 @@ public class JavabinLoader extends ContentStreamLoader {for (String s : update.getDeleteById()) {delcmd.id = s;processor.processDelete(delcmd);+ delcmd.clear();}- delcmd.id = null;}if(update.getDeleteQuery() != null) {diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.javaindex 476b6d4dd2d..3a872299d21 100644--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java@@ -711,16 +711,11 @@ abstract public class SolrExampleTests extends SolrJettyTestBaseassertNumFound( "*:*", 3 ); // make sure it got in// should be able to handle multiple delete commands in a single go- StringWriter xml = new StringWriter();- xml.append( "<delete>" );+ List<String> ids = new ArrayList<String>();for( SolrInputDocument d : doc ) {- xml.append( "<id>" );- XML.escapeCharData( (String)d.getField( "id" ).getFirstValue(), xml );- xml.append( "</id>" );+ ids.add(d.getFieldValue("id").toString());}- xml.append( "</delete>" );- DirectXmlRequest up = new DirectXmlRequest( "/update", xml.toString() );- server.request( up );+ server.deleteById(ids);server.commit();assertNumFound( "*:*", 0 ); // make sure it got out}