sselinkurt
sselinkurt

Reputation: 11

How to update solrconfig.xml with Java code? (Solr Cloud)

I want to edit solrconfig.xml to enable Solr SpellCheck.(Using solr cloud) I already do this via zookeper on the server, but I want to implement this in my Java code.

Is there any idea how to update/add solrconfig.xml on Solr Cloud with Java? Thanks

Upvotes: 1

Views: 135

Answers (1)

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8678

You can try the below code to upload the configs.

public void uploadConfig(String confName, File confDir) throws IOException {
  SolrZkClient zkClient = new SolrZkClient(zkConnectString, 30000, 30000,
      new OnReconnect() {
        @Override
        public void command() {
        }
      });
  new ZkConfigManager(zkClient).uploadConfigDir(confDir.toPath(), confName);
  zkClient.close();
}

Upvotes: 0

Related Questions