Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-653 -- remove the 'overwrite' options from solrj. Since we plan to remove these in the future, we should keep them out of the API before its first official release.

Ryan McKinleyba127328c5ff
diff --git a/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java b/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java
index daa043fc0e4..74e6f91acff 100644
--- a/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java
+++ b/client/java/solrj/src/org/apache/solr/client/solrj/SolrServer.java
@@ -42,47 +42,29 @@ public abstract class SolrServer implements Serializable
{
private DocumentObjectBinder binder;
- public UpdateResponse add(Collection<SolrInputDocument> docs, boolean overwrite ) throws SolrServerException, IOException {
+ public UpdateResponse add(Collection<SolrInputDocument> docs ) throws SolrServerException, IOException {
UpdateRequest req = new UpdateRequest();
req.add(docs);
- req.setOverwrite(overwrite);
return req.process(this);
}
- public UpdateResponse addBeans(Collection<?> beans, boolean overwrite ) throws SolrServerException, IOException {
+ public UpdateResponse addBeans(Collection<?> beans ) throws SolrServerException, IOException {
DocumentObjectBinder binder = this.getBinder();
ArrayList<SolrInputDocument> docs = new ArrayList<SolrInputDocument>(beans.size());
for (Object bean : beans) {
docs.add(binder.toSolrInputDocument(bean));
}
- return add(docs,overwrite);
+ return add(docs);
}
- public UpdateResponse add(SolrInputDocument doc, boolean overwrite ) throws SolrServerException, IOException {
+ public UpdateResponse add(SolrInputDocument doc ) throws SolrServerException, IOException {
UpdateRequest req = new UpdateRequest();
req.add(doc);
- req.setOverwrite(overwrite);
return req.process(this);
}
- public UpdateResponse addBean(Object obj, boolean overwrite) throws IOException, SolrServerException {
- return add(getBinder().toSolrInputDocument(obj), overwrite);
- }
-
- public UpdateResponse add(SolrInputDocument doc) throws SolrServerException, IOException {
- return add(doc, true);
- }
-
public UpdateResponse addBean(Object obj) throws IOException, SolrServerException {
- return add(getBinder().toSolrInputDocument(obj), true);
- }
-
- public UpdateResponse add(Collection<SolrInputDocument> docs) throws SolrServerException, IOException {
- return add(docs, true);
- }
-
- public UpdateResponse addBeans(Collection<?> beans ) throws SolrServerException, IOException {
- return addBeans(beans,true);
+ return add(getBinder().toSolrInputDocument(obj));
}
/** waitFlush=true and waitSearcher=true to be inline with the defaults for plain HTTP access
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 e7b224492ed..e7523941244 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
@@ -30,7 +30,6 @@ import org.apache.solr.client.solrj.response.UpdateResponse;
import org.apache.solr.client.solrj.util.ClientUtils;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.params.UpdateParams;
import org.apache.solr.common.util.ContentStream;
import org.apache.solr.common.util.XML;
@@ -47,11 +46,6 @@ public class UpdateRequest extends SolrRequest
OPTIMIZE
};
-
- private boolean allowDups = false;
- private boolean overwriteCommitted = true;
- private boolean overwritePending = true;
-
private List<SolrInputDocument> documents = null;
private List<String> deleteById = null;
private List<String> deleteQuery = null;
@@ -169,11 +163,7 @@ public class UpdateRequest extends SolrRequest
public String getXML() throws IOException {
StringWriter writer = new StringWriter();
if( documents != null && documents.size() > 0 ) {
- writer.write("<add ");
- writer.write("allowDups=\"" + allowDups + "\" ");
- // TODO: remove these when deprecations are removed
- writer.write("overwriteCommitted=\"" + overwriteCommitted + "\" ");
- writer.write("overwritePending=\"" + overwritePending + "\">");
+ writer.write("<add>");
for (SolrInputDocument doc : documents ) {
if( doc != null ) {
ClientUtils.writeXML( doc, writer );
@@ -227,17 +217,6 @@ public class UpdateRequest extends SolrRequest
res.setElapsedTime( System.currentTimeMillis()-startTime );
return res;
}
-
- //--------------------------------------------------------------------------
- //
- //--------------------------------------------------------------------------
-
- public void setOverwrite( boolean v )
- {
- allowDups = !v;
- overwriteCommitted = v;
- overwritePending = v;
- }
//--------------------------------------------------------------------------
//
@@ -258,44 +237,6 @@ public class UpdateRequest extends SolrRequest
return null;
}
- public boolean isAllowDups() {
- return allowDups;
- }
-
- /**
- * Use setOverwrite()
- */
- @Deprecated
- public void setAllowDups(boolean allowDups) {
- this.allowDups = allowDups;
- }
-
- @Deprecated
- public boolean isOverwriteCommitted() {
- return overwriteCommitted;
- }
-
- /**
- * Use setOverwrite()
- */
- @Deprecated
- public void setOverwriteCommitted(boolean overwriteCommitted) {
- this.overwriteCommitted = overwriteCommitted;
- }
-
- @Deprecated
- public boolean isOverwritePending() {
- return overwritePending;
- }
-
- /**
- * Use setOverwrite()
- */
- @Deprecated
- public void setOverwritePending(boolean overwritePending) {
- this.overwritePending = overwritePending;
- }
-
public void setWaitFlush(boolean waitFlush) {
setParam( UpdateParams.WAIT_FLUSH, waitFlush+"" );
}