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.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@679548 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2008-07-24 21:17:43 +00:00
parent 90146c2bb3
commit ba127328c5
2 changed files with 6 additions and 83 deletions

View File

@ -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

View File

@ -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+"" );
}