3

请建议,我如何运行 command=full-import?

 SolrServer solrServer = new HttpSolrServer("http://localhost:8080/solr");

然后呢...

谢谢!

4

2 回答 2

5

看看这个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);
于 2012-08-03T14:48:16.260 回答
1

在 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);
于 2019-03-08T04:39:40.937 回答