You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Ankit Jain <an...@gmail.com> on 2014/12/02 09:27:29 UTC

Get list of collection

Hi All,

I have a requirement to get the list of *collection* available in Solr. we
are using solrj library.

I am able to fetch the list of cores but not getting ways to fetch the list
of collections.

Below is the sample example, that i am using to fetch the cores:

        CoreAdminRequest request = new CoreAdminRequest();
        request.setAction(CoreAdminAction.STATUS);
        CoreAdminResponse cores = request.process(server);

        // List of the cores
        List<String> coreList = new ArrayList<String>();
        for (int i = 0; i < cores.getCoreStatus().size(); i++) {
            coreList.add(cores.getCoreStatus().getName(i));
        }

Please help.

-- 
Thanks,
Ankit Jain

Re: Get list of collection

Posted by Ankit Jain <an...@gmail.com>.
Thanks Shawn ...

Thanks,
Ankit

On Wed, Dec 3, 2014 at 9:40 PM, Shawn Heisey <ap...@elyograg.org> wrote:

> On 12/3/2014 2:51 AM, Ankit Jain wrote:
> > Hi Erick,
> >
> > We are using the 4.7.2 version of solr and no getCollectionList() method
> is
> > present in CloudSolrServer class.
>
> That method is private, so you can't use it in a user program.  I think
> this would probably do what you want, if server is an instance of
> CloudSolrServer:
>
> Set<String> list =
> server.getZkStateReader().getClusterState().getCollections();
>
> Thanks,
> Shawn
>
>


-- 
Thanks,
Ankit Jain

Re: Get list of collection

Posted by Erick Erickson <er...@gmail.com>.
Gaaah, Shawn is exactly correct, sorry for the confusion...

Erick

On Wed, Dec 3, 2014 at 8:10 AM, Shawn Heisey <ap...@elyograg.org> wrote:
> On 12/3/2014 2:51 AM, Ankit Jain wrote:
>> Hi Erick,
>>
>> We are using the 4.7.2 version of solr and no getCollectionList() method is
>> present in CloudSolrServer class.
>
> That method is private, so you can't use it in a user program.  I think
> this would probably do what you want, if server is an instance of
> CloudSolrServer:
>
> Set<String> list =
> server.getZkStateReader().getClusterState().getCollections();
>
> Thanks,
> Shawn
>

Re: Get list of collection

Posted by Shawn Heisey <ap...@elyograg.org>.
On 12/3/2014 2:51 AM, Ankit Jain wrote:
> Hi Erick,
>
> We are using the 4.7.2 version of solr and no getCollectionList() method is
> present in CloudSolrServer class.

That method is private, so you can't use it in a user program.  I think
this would probably do what you want, if server is an instance of
CloudSolrServer:

Set<String> list =
server.getZkStateReader().getClusterState().getCollections();

Thanks,
Shawn


Re: Get list of collection

Posted by Ankit Jain <an...@gmail.com>.
Hi Erick,

We are using the 4.7.2 version of solr and no getCollectionList() method is
present in CloudSolrServer class.

Regards,
Ankit Jain

On Tue, Dec 2, 2014 at 8:18 PM, Erick Erickson <er...@gmail.com>
wrote:

> I think you want CloudSolrServer.getCollectionList()
>
> Best,
> Erick
>
> On Tue, Dec 2, 2014 at 12:27 AM, Ankit Jain <an...@gmail.com>
> wrote:
> > Hi All,
> >
> > I have a requirement to get the list of *collection* available in Solr.
> we
> > are using solrj library.
> >
> > I am able to fetch the list of cores but not getting ways to fetch the
> list
> > of collections.
> >
> > Below is the sample example, that i am using to fetch the cores:
> >
> >         CoreAdminRequest request = new CoreAdminRequest();
> >         request.setAction(CoreAdminAction.STATUS);
> >         CoreAdminResponse cores = request.process(server);
> >
> >         // List of the cores
> >         List<String> coreList = new ArrayList<String>();
> >         for (int i = 0; i < cores.getCoreStatus().size(); i++) {
> >             coreList.add(cores.getCoreStatus().getName(i));
> >         }
> >
> > Please help.
> >
> > --
> > Thanks,
> > Ankit Jain
>



-- 
Thanks,
Ankit Jain

Re: Get list of collection

Posted by Erick Erickson <er...@gmail.com>.
I think you want CloudSolrServer.getCollectionList()

Best,
Erick

On Tue, Dec 2, 2014 at 12:27 AM, Ankit Jain <an...@gmail.com> wrote:
> Hi All,
>
> I have a requirement to get the list of *collection* available in Solr. we
> are using solrj library.
>
> I am able to fetch the list of cores but not getting ways to fetch the list
> of collections.
>
> Below is the sample example, that i am using to fetch the cores:
>
>         CoreAdminRequest request = new CoreAdminRequest();
>         request.setAction(CoreAdminAction.STATUS);
>         CoreAdminResponse cores = request.process(server);
>
>         // List of the cores
>         List<String> coreList = new ArrayList<String>();
>         for (int i = 0; i < cores.getCoreStatus().size(); i++) {
>             coreList.add(cores.getCoreStatus().getName(i));
>         }
>
> Please help.
>
> --
> Thanks,
> Ankit Jain