请建议,我如何运行 command=full-import?
SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");
然后呢...
谢谢!
看看这个wiki页面和那里的拼写检查示例。它使用旧CommonsHttpSolrServer
的,但与您想要的相似。这段代码应该是您正在寻找的,即使我还没有尝试过:
SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");
ModifiableSolrParams params = new ModifiableSolrParams();
params.set("qt", "/dataimport");
params.set("command", "full-import");
QueryResponse response = solrServer.query(params);
在 SolrJ 7 中
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
SolrClient client = new HttpSolrClient.Builder("http://localhost:8983/solr/test_core").build();
SolrQuery query = new SolrQuery();
query.set("qt", "/dataimport");
query.set("command", "full-import");
QueryResponse response = client.query(query);