Java Spring数据solr数据导入处理程序调用
我正在使用并且已经在solr中使用了。如何通过repository、SolrTemplate或其他方式调用DIH?我建议使用Java Spring数据solr数据导入处理程序调用,java,solr,spring-data,spring-data-solr,Java,Solr,Spring Data,Spring Data Solr,我正在使用并且已经在solr中使用了。如何通过repository、SolrTemplate或其他方式调用DIH?我建议使用SolrCallback自定义响应来执行所需的请求 @Override public SolrResponse dataImport(final String command) { return solrTemplate.execute(new SolrCallback<SolrResponse>() { @Ove
SolrCallback
自定义响应来执行所需的请求
@Override
public SolrResponse dataImport(final String command) {
return solrTemplate.execute(new SolrCallback<SolrResponse>() {
@Override
public SolrResponse doInSolr(SolrServer solrServer) throws SolrServerException, IOException {
return new SolrRequest(METHOD.GET, "/dataimport?command=" + command) {
//..skipped some methods to shorten
@Override
public SolrResponse process(SolrServer server) throws SolrServerException, IOException {
SolrResponseBase response = new SolrResponseBase();
response.setResponse(server.request(this));
return response;
}
}.process(solrServer);
}
});
}
@覆盖
公共SolrResponse数据导入(最终字符串命令){
返回solrTemplate.execute(新的SolrCallback(){
@凌驾
公共SolrResponse doInSolr(SolrServer SolrServer)抛出SolrServerException,IOException{
返回新的SolrRequest(METHOD.GET,“/dataimport?command=“+command”){
//…跳过了一些缩短时间的方法
@凌驾
公共SolrResponse进程(SolrServer服务器)抛出SolrServerException、IOException{
SolrResponseBase response=新的SolrResponseBase();
response.setResponse(server.request(this));
返回响应;
}
}.进程(solrServer);
}
});
}