简体   繁体   English

如何使用SolrJ运行完全导入命令

[英]How to run full-import command using SolrJ

Plz suggest, how I can run command=full-import? Plz建议,我怎么能运行command = full-import?

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

And what then... 那么......

thanks! 谢谢!

Have a look at this wiki page and the spellcheck example there. 看一下这个wiki页面和那里的拼写检查示例。 It uses the old CommonsHttpSolrServer but it's similar to what you want. 它使用旧的CommonsHttpSolrServer但它与你想要的类似。 This code should be what you're looking for, even though I haven't tried it yet: 这段代码应该是您正在寻找的,即使我还没有尝试过:

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);

In SolrJ 7 在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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM