Search code examples
javasolrsolrj

How to run full-import command using SolrJ


Plz suggest, how I can run command=full-import?

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

And what then...

thanks!


Solution

  • Have a look at this wiki page and the spellcheck example there. It uses the old CommonsHttpSolrServer but it's similar to what you want. 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);