Thanks! On Apr 13, 2015 7:18 PM, "Shalin Shekhar Mangar" <[email protected]> wrote:
> I opened https://issues.apache.org/jira/browse/SOLR-7385 > > On Mon, Apr 13, 2015 at 8:08 PM, Shai Erera <[email protected]> wrote: > >> Thanks Shalin, don't know how did I miss it :). I see that besides just >> reading the configuration name, it also checks that it exists which is nice. >> >> We should add this information to the cluster status API >>> >> >> +1! >> >> Shai >> >> On Mon, Apr 13, 2015 at 5:08 PM, Shalin Shekhar Mangar < >> [email protected]> wrote: >> >>> You can use the oddly named ZkStateReader.readConfigName(String >>> Collection) to get this information. We should add this information to the >>> cluster status API. >>> >>> On Mon, Apr 13, 2015 at 6:58 PM, Shai Erera <[email protected]> wrote: >>> >>>> Hi >>>> >>>> I was looking for some API (Java or REST) for retrieving the >>>> configuration name with which a collection was created. It doesn't appear >>>> as part of the cluster status information, nor is part of the DocCollection >>>> class. >>>> >>>> I eventually wrote this code: >>>> >>>> /** Returns a collection's configuration name, or {@code null} if the >>>> collection doesn't exist. */ >>>> public static String getCollectionConfigName(ZkStateReader >>>> zkStateReader, String collection) { >>>> try { >>>> final String collectionZkNode = ZkStateReader.COLLECTIONS_ZKNODE >>>> + "/" + collection; >>>> final byte[] data = >>>> zkStateReader.getZkClient().getData(collectionZkNode, null, null, true); >>>> final ZkNodeProps nodeProps = ZkNodeProps.load(data); >>>> final String collectionConfigName = >>>> nodeProps.getStr(ZkStateReader.CONFIGNAME_PROP); >>>> return collectionConfigName; >>>> } catch (NoNodeException e) { >>>> return null; >>>> } catch (KeeperException | InterruptedException e) { >>>> throw Throwables.propagate(e); >>>> } >>>> } >>>> >>>> This works but feels "hacky" as none of this is documented anywhere. So >>>> if anyone is aware of an existing class/method which does that, even if >>>> it's not truly "public API", I'd appreciate a pointer. >>>> >>>> Also, would it make sense to add this information to DocCollection, >>>> e.g. docCollection.getConfigName()? >>>> >>>> Shai >>>> >>> >>> >>> >>> -- >>> Regards, >>> Shalin Shekhar Mangar. >>> >> >> > > > -- > Regards, > Shalin Shekhar Mangar. >
