mirror of https://github.com/apache/lucene.git
SOLR-1930: remove solr deprecations - delete.fromCommitted/fromPending
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1052905 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5ee58ef139
commit
42f25e65e0
|
@ -86,8 +86,6 @@ public class SolrWriter {
|
|||
log.info("Deleting document: " + id);
|
||||
DeleteUpdateCommand delCmd = new DeleteUpdateCommand();
|
||||
delCmd.id = id.toString();
|
||||
delCmd.fromPending = true;
|
||||
delCmd.fromCommitted = true;
|
||||
processor.processDelete(delCmd);
|
||||
} catch (IOException e) {
|
||||
log.error("Exception while deleteing: " + id, e);
|
||||
|
@ -162,8 +160,6 @@ public class SolrWriter {
|
|||
log.info("Deleting documents from Solr with query: " + query);
|
||||
DeleteUpdateCommand delCmd = new DeleteUpdateCommand();
|
||||
delCmd.query = query;
|
||||
delCmd.fromCommitted = true;
|
||||
delCmd.fromPending = true;
|
||||
processor.processDelete(delCmd);
|
||||
} catch (IOException e) {
|
||||
log.error("Exception while deleting by query: " + query, e);
|
||||
|
@ -192,8 +188,6 @@ public class SolrWriter {
|
|||
try {
|
||||
DeleteUpdateCommand deleteCommand = new DeleteUpdateCommand();
|
||||
deleteCommand.query = "*:*";
|
||||
deleteCommand.fromCommitted = true;
|
||||
deleteCommand.fromPending = true;
|
||||
processor.processDelete(deleteCommand);
|
||||
} catch (IOException e) {
|
||||
throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
|
||||
|
|
|
@ -123,8 +123,6 @@ public class BinaryUpdateRequestHandler extends ContentStreamHandlerBase {
|
|||
} else {
|
||||
delcmd.query = s;
|
||||
}
|
||||
delcmd.fromCommitted = true;
|
||||
delcmd.fromPending = true;
|
||||
processor.processDelete(delcmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,6 @@ class JsonLoader extends ContentStreamLoader {
|
|||
assertNextEvent( js, JSONParser.OBJECT_START );
|
||||
|
||||
DeleteUpdateCommand cmd = new DeleteUpdateCommand();
|
||||
cmd.fromCommitted = cmd.fromPending = true; // TODO? enable this?
|
||||
|
||||
while( true ) {
|
||||
int ev = js.nextEvent();
|
||||
|
|
|
@ -190,15 +190,14 @@ class XMLLoader extends ContentStreamLoader {
|
|||
void processDelete(UpdateRequestProcessor processor, XMLStreamReader parser) throws XMLStreamException, IOException {
|
||||
// Parse the command
|
||||
DeleteUpdateCommand deleteCmd = new DeleteUpdateCommand();
|
||||
deleteCmd.fromPending = true;
|
||||
deleteCmd.fromCommitted = true;
|
||||
|
||||
for (int i = 0; i < parser.getAttributeCount(); i++) {
|
||||
String attrName = parser.getAttributeLocalName(i);
|
||||
String attrVal = parser.getAttributeValue(i);
|
||||
if ("fromPending".equals(attrName)) {
|
||||
deleteCmd.fromPending = StrUtils.parseBoolean(attrVal);
|
||||
// deprecated
|
||||
} else if ("fromCommitted".equals(attrName)) {
|
||||
deleteCmd.fromCommitted = StrUtils.parseBoolean(attrVal);
|
||||
// deprecated
|
||||
} else {
|
||||
XmlUpdateRequestHandler.log.warn("unexpected attribute delete/@" + attrName);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ package org.apache.solr.update;
|
|||
public class DeleteUpdateCommand extends UpdateCommand {
|
||||
public String id; // external (printable) id, for delete-by-id
|
||||
public String query; // query string for delete-by-query
|
||||
public boolean fromPending;
|
||||
public boolean fromCommitted;
|
||||
|
||||
public DeleteUpdateCommand() {
|
||||
super("delete");
|
||||
|
@ -34,8 +32,6 @@ public class DeleteUpdateCommand extends UpdateCommand {
|
|||
sb.append(':');
|
||||
if (id!=null) sb.append("id=").append(id);
|
||||
else sb.append("query=`").append(query).append('`');
|
||||
sb.append(",fromPending=").append(fromPending);
|
||||
sb.append(",fromCommitted=").append(fromCommitted);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,17 +270,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
deleteByIdCommands.incrementAndGet();
|
||||
deleteByIdCommandsCumulative.incrementAndGet();
|
||||
|
||||
if (!cmd.fromPending && !cmd.fromCommitted) {
|
||||
numErrors.incrementAndGet();
|
||||
numErrorsCumulative.incrementAndGet();
|
||||
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"meaningless command: " + cmd);
|
||||
}
|
||||
if (!cmd.fromPending || !cmd.fromCommitted) {
|
||||
numErrors.incrementAndGet();
|
||||
numErrorsCumulative.incrementAndGet();
|
||||
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"operation not supported" + cmd);
|
||||
}
|
||||
|
||||
iwCommit.lock();
|
||||
try {
|
||||
openWriter();
|
||||
|
@ -300,17 +289,6 @@ public class DirectUpdateHandler2 extends UpdateHandler {
|
|||
deleteByQueryCommands.incrementAndGet();
|
||||
deleteByQueryCommandsCumulative.incrementAndGet();
|
||||
|
||||
if (!cmd.fromPending && !cmd.fromCommitted) {
|
||||
numErrors.incrementAndGet();
|
||||
numErrorsCumulative.incrementAndGet();
|
||||
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"meaningless command: " + cmd);
|
||||
}
|
||||
if (!cmd.fromPending || !cmd.fromCommitted) {
|
||||
numErrors.incrementAndGet();
|
||||
numErrorsCumulative.incrementAndGet();
|
||||
throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"operation not supported" + cmd);
|
||||
}
|
||||
|
||||
boolean madeIt=false;
|
||||
boolean delAll=false;
|
||||
try {
|
||||
|
|
|
@ -354,8 +354,6 @@ public class DirectUpdateHandlerTest extends SolrTestCaseJ4 {
|
|||
// Delete the document
|
||||
DeleteUpdateCommand cmd = new DeleteUpdateCommand();
|
||||
cmd.id = id;
|
||||
cmd.fromCommitted = true;
|
||||
cmd.fromPending = true;
|
||||
|
||||
updater.delete(cmd);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue