Hello Arnold, In the Factory's inform() method you receive a SolrCore reference. Using this you can get the CloudDescriptor and the ZkController references. These provide access to what you need to open a connection for SolrClient.
Our plugins usually work in cloud and non-cloud environments, so we initialize different things for each situation. Like this abstracted in some CloudUtils thing: cloudDescriptor = core.getCoreDescriptor().getCloudDescriptor(); zk = core.getCoreContainer().getZkController(); // this is the ZkController ref coreName = core.getCoreDescriptor().getName(); // Are we in cloud mode? if (zk != null) { collectionName = core.getCoreDescriptor().getCollectionName(); shardId = cloudDescriptor.getShardId(); } else { collectionName = null; shardId = null; } Depending on cloudMode we create new SolrClient instances based on these classes. Check the apidocs and you'll quickly see what you need. We use these api's to get what we need. But you can also find these things if you check the Java system properties, which is easier. We use the api's to read the data because if api's change, we get a compile error. If the system properties change, we don't. So the system properties is easier, but the api's are safer. Although a unit tests should guard against that as well. Regards, Markus ps, on this list there is normally no need to create a new thread for an existing one, even if you are eagerly waiting for a reply. It might take some patience though. -----Original message----- > From:Arnold Bronley <arnoldbron...@gmail.com> > Sent: Thursday 5th September 2019 18:44 > To: solr-user@lucene.apache.org > Subject: Re: SolrClient from inside processAdd function > > Hi Markus, > > Is there any way to get the information about the current Solr endpoint > from within the custom URP? > > On Wed, Sep 4, 2019 at 3:10 PM Markus Jelsma <markus.jel...@openindex.io> > wrote: > > > Hello Arnold, > > > > Yes, we do this too for several cases. > > > > You can create the SolrClient in the Factory's inform() method, and pass > > is to the URP when it is created. You must implement SolrCoreAware and > > close the client when the core closes as well. Use a CloseHook for this. > > > > If you do not close the client, it will cause trouble if you run unit > > tests, and most certainly when you regularly reload cores. > > > > Regards, > > Markus > > > > > > > > -----Original message----- > > > From:Arnold Bronley <arnoldbron...@gmail.com> > > > Sent: Wednesday 4th September 2019 20:10 > > > To: solr-user@lucene.apache.org > > > Subject: Re: SolrClient from inside processAdd function > > > > > > I need to search some other collection inside processAdd function and > > > append that information to the indexing request. > > > > > > On Tue, Sep 3, 2019 at 7:55 PM Erick Erickson <erickerick...@gmail.com> > > > wrote: > > > > > > > This really sounds like an XY problem. What do you need the SolrClient > > > > _for_? I suspect there’s an easier way to do this….. > > > > > > > > Best, > > > > Erick > > > > > > > > > On Sep 3, 2019, at 6:17 PM, Arnold Bronley <arnoldbron...@gmail.com> > > > > wrote: > > > > > > > > > > Hi, > > > > > > > > > > Is there a way to create SolrClient from inside processAdd function > > for > > > > > custom update processor for the same Solr on which it is executing? > > > > > > > > > > > > > >