diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 250b191f110..1e25fbab718 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -427,6 +427,10 @@ New Features * SOLR-2906: Added LFU cache options to Solr. (Shawn Heisey via Erick Erickson) +* SOLR-3036: Ability to specify overwrite=false on the URL for XML updates. + (Sami Siren via yonik) + + Optimizations ---------------------- * SOLR-1931: Speedup for LukeRequestHandler and admin/schema browser. New parameter @@ -436,6 +440,7 @@ Optimizations * SOLR-3012: Move System.getProperty("type") in postData() to main() and add type argument so that the client applications of SimplePostTool can set content type via method argument. (koji) + Bug Fixes ---------------------- * SOLR-2912: Fixed File descriptor leak in ShowFileRequestHandler (Michael Ryan, shalin) diff --git a/solr/core/src/java/org/apache/solr/handler/XMLLoader.java b/solr/core/src/java/org/apache/solr/handler/XMLLoader.java index 59817acdbc0..7102f093f32 100644 --- a/solr/core/src/java/org/apache/solr/handler/XMLLoader.java +++ b/solr/core/src/java/org/apache/solr/handler/XMLLoader.java @@ -112,6 +112,7 @@ class XMLLoader extends ContentStreamLoader { // First look for commitWithin parameter on the request, will be overwritten for individual 's addCmd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1); + addCmd.overwrite = params.getBool(UpdateParams.OVERWRITE, true); for (int i = 0; i < parser.getAttributeCount(); i++) { String attrName = parser.getAttributeLocalName(i); diff --git a/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java index 51fd7d02ea5..086912ca5c9 100644 --- a/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java +++ b/solr/core/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java @@ -80,7 +80,7 @@ public class XmlUpdateRequestHandlerTest extends SolrTestCaseJ4 { } @Test - public void testCommitWithin() throws Exception + public void testRequestParams() throws Exception { String xml = "" + @@ -90,7 +90,7 @@ public class XmlUpdateRequestHandlerTest extends SolrTestCaseJ4 { " " + ""; - SolrQueryRequest req = req("commitWithin","100"); + SolrQueryRequest req = req("commitWithin","100","overwrite","false"); SolrQueryResponse rsp = new SolrQueryResponse(); BufferingRequestProcessor p = new BufferingRequestProcessor(null); @@ -98,8 +98,8 @@ public class XmlUpdateRequestHandlerTest extends SolrTestCaseJ4 { loader.load(req, rsp, new ContentStreamBase.StringStream(xml)); AddUpdateCommand add = p.addCommands.get(0); - assertEquals(add.commitWithin, 100); - + assertEquals(100, add.commitWithin); + assertEquals(false, add.overwrite); req.close(); }