[英]How to run full-import command using SolrJ
Plz建議,我怎么能運行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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.