1

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

sselinkurt
  • 11
  • 1
  • You'll have to use ZooKeeper API to update file on ZooKeeper. This can be done with Java if you want to but a simple bash script could be enough. – Gaël J Feb 20 '22 at 19:45

1 Answers1

0

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();
}
Abhijit Bashetti
  • 8,518
  • 7
  • 35
  • 47