本文整理汇总了Java中org.apache.solr.update.DeleteUpdateCommand类的典型用法代码示例。如果您正苦于以下问题:Java DeleteUpdateCommand类的具体用法?Java DeleteUpdateCommand怎么用?Java DeleteUpdateCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeleteUpdateCommand类属于org.apache.solr.update包,在下文中一共展示了DeleteUpdateCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isLeader
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
boolean isLeader(UpdateCommand cmd) {
updateCommand = cmd;
if (zkEnabled) {
zkCheck();
if (cmd instanceof AddUpdateCommand) {
AddUpdateCommand acmd = (AddUpdateCommand)cmd;
nodes = setupRequest(acmd.getHashableId(), acmd.getSolrInputDocument());
} else if (cmd instanceof DeleteUpdateCommand) {
DeleteUpdateCommand dcmd = (DeleteUpdateCommand)cmd;
nodes = setupRequest(dcmd.getId(), null);
}
} else {
isLeader = getNonZkLeaderAssumption(req);
}
return isLeader;
}
示例2: processDeleteById
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
protected void processDeleteById(final String chain, String id) throws IOException {
SolrCore core = h.getCore();
UpdateRequestProcessorChain pc = core.getUpdateProcessingChain(chain);
assertNotNull("No Chain named: " + chain, pc);
SolrQueryResponse rsp = new SolrQueryResponse();
SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
DeleteUpdateCommand cmd = new DeleteUpdateCommand(req);
cmd.setId(id);
UpdateRequestProcessor processor = pc.createProcessor(req, rsp);
try {
processor.processDelete(cmd);
} finally {
req.close();
}
}
示例3: processDelete
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
@Override
public void processDelete(DeleteUpdateCommand cmd) throws IOException {
String id = cmd.getId();
if (id == null) {
//only process *:* for now
if ("*:*".equals(cmd.getQuery())) {
synchronized (esProcessor) {
esProcessor.deleteAll();
}
} else {
log.warn("Ignoring Delete by query: " + cmd.getQuery());
}
} else {
synchronized (esProcessor) {
esProcessor.delete(id);
}
}
super.processDelete(cmd);
}
示例4: deleteByQuery
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
private void deleteByQuery(String query) throws IOException
{
SolrQueryRequest request = null;
UpdateRequestProcessor processor = null;
try
{
request = getLocalSolrQueryRequest();
processor = this.core.getUpdateProcessingChain(null).createProcessor(request, new SolrQueryResponse());
DeleteUpdateCommand delDocCmd = new DeleteUpdateCommand(request);
delDocCmd.setQuery(query);
processor.processDelete(delDocCmd);
}
finally
{
if(processor != null) {processor.finish();}
if(request != null) {request.close();}
}
}
示例5: delete
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
/**
* Deletes documents identified by the given documents.
*
* @param docs the documents
* @throws IOException iff something goes wrong
*/
public void delete(Collection<Document> docs) throws IOException {
DeleteUpdateCommand cmd = new DeleteUpdateCommand(req);
cmd.commitWithin = COMMIT_WITHIN;
cmd.setFlags(DeleteUpdateCommand.BUFFERING);
cmd.setQuery("{!terms f=" + ID + "}" + docs.stream().map(it -> it.get(ID)).collect(joining(",")));
updateProcessor.processDelete(cmd);
}
示例6: deleteDoc
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
@Override
public void deleteDoc(Object id) {
try {
log.info("Deleting document: " + id);
DeleteUpdateCommand delCmd = new DeleteUpdateCommand(req);
delCmd.setId(id.toString());
processor.processDelete(delCmd);
} catch (IOException e) {
log.error("Exception while deleteing: " + id, e);
}
}
示例7: deleteByQuery
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
@Override
public void deleteByQuery(String query) {
try {
log.info("Deleting documents from Solr with query: " + query);
DeleteUpdateCommand delCmd = new DeleteUpdateCommand(req);
delCmd.query = query;
processor.processDelete(delCmd);
} catch (IOException e) {
log.error("Exception while deleting by query: " + query, e);
}
}
示例8: doDeleteAll
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
@Override
public void doDeleteAll() {
try {
DeleteUpdateCommand deleteCommand = new DeleteUpdateCommand(req);
deleteCommand.query = "*:*";
processor.processDelete(deleteCommand);
} catch (IOException e) {
throw new DataImportHandlerException(DataImportHandlerException.SEVERE,
"Exception in full dump while deleting all documents.", e);
}
}
示例9: handleSingleDelete
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
void handleSingleDelete(int ev) throws IOException {
if (ev == JSONParser.OBJECT_START) {
handleDeleteMap(ev);
} else {
DeleteUpdateCommand cmd = new DeleteUpdateCommand(req);
cmd.commitWithin = commitWithin;
String id = getString(ev);
cmd.setId(id);
processor.processDelete(cmd);
}
}
示例10: delete
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
private void delete(SolrQueryRequest req, UpdateRequest update, UpdateRequestProcessor processor) throws IOException {
SolrParams params = update.getParams();
DeleteUpdateCommand delcmd = new DeleteUpdateCommand(req);
if(params != null) {
delcmd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);
}
if(update.getDeleteByIdMap() != null) {
Set<Entry<String,Map<String,Object>>> entries = update.getDeleteByIdMap().entrySet();
for (Entry<String,Map<String,Object>> e : entries) {
delcmd.id = e.getKey();
Map<String,Object> map = e.getValue();
if (map != null) {
Long version = (Long) map.get("ver");
if (version != null) {
delcmd.setVersion(version);
}
}
processor.processDelete(delcmd);
delcmd.clear();
}
}
if(update.getDeleteQuery() != null) {
for (String s : update.getDeleteQuery()) {
delcmd.query = s;
processor.processDelete(delcmd);
}
}
}
示例11: expectDelete
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
public void expectDelete(String id, String query, int commitWithin) {
DeleteUpdateCommand cmd = new DeleteUpdateCommand(null);
cmd.id = id;
cmd.query = query;
cmd.commitWithin = commitWithin;
deleteCommands.add(cmd);
}
示例12: processDelete
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
@Override
public void processDelete(DeleteUpdateCommand cmd) throws IOException {
DeleteUpdateCommand expected = deleteCommands.poll();
assertNotNull("Unexpected delete command: [" + cmd + "]", expected);
assertTrue("Expected [" + expected + "] but found [" + cmd + "]",
ObjectUtils.equals(expected.id, cmd.id) &&
ObjectUtils.equals(expected.query, cmd.query) &&
expected.commitWithin==cmd.commitWithin);
}
示例13: deleteNode
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
private void deleteNode(UpdateRequestProcessor processor, SolrQueryRequest request, Node node) throws IOException
{
String errorDocId = PREFIX_ERROR + node.getId();
DeleteUpdateCommand delErrorDocCmd = new DeleteUpdateCommand(request);
delErrorDocCmd.setId(errorDocId);
processor.processDelete(delErrorDocCmd);
// MNT-13767 fix, remove by node DBID.
deleteNode(processor, request, node.getId());
}
示例14: performDelete
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
@Override
public void performDelete(final Triple triple) {
final DeleteUpdateCommand deleteCommand = new DeleteUpdateCommand(request);
deleteCommand.query = deleteQuery(triple);
try {
updateProcessor.processDelete(deleteCommand);
} catch (final Exception exception) {
LOGGER.error(MessageCatalog._00113_NWS_FAILURE, exception);
throw new DeleteDeniedException(exception.getMessage(), triple);
}
}
示例15: deleteDoc
import org.apache.solr.update.DeleteUpdateCommand; //导入依赖的package包/类
public boolean deleteDoc(Object id, SolrQueryRequest req) {
boolean success = false;
try {
LOG.info("Deleting document:" + id);
DeleteUpdateCommand delCmd = new DeleteUpdateCommand(req);
delCmd.setId(id.toString());
SolrQueryResponse rsp = new SolrQueryResponse();
UpdateRequestProcessor processor = handler.getProcessorChain().createProcessor(req, rsp);
processor.processDelete(delCmd);
success = true;
} catch (IOException e) {
LOG.error("Exception while deleting doc:" + id, e);
}
return success;
}