On 10/15/2013 2:55 AM, xinwu wrote: > I want to know how to check the collection status by using the solrj in > solrCloud. > > Ps:I created one independent collection every day ,the name may looks > like "collection-20131015". > > By the way , where can I find the solrj api document?
There really isn't any way to query a collection for status or statistics at the moment. You can query cores for that information, but getting the names of the cores based on the collection name currently requires that you delve into Solr's zookeeper classes, there's no API URL for it. For the core status, you need to create a SolrQuery object and use setRequestHandler to talk to "/admin/cores". Don't worry about setting a query, that parameter is unnecessary. The resulting response object has a getResponse method that will return the entire response as a NamedList, which is an object that is fairly easy to navigate. SolrJ is an integral part of Solr itself. Its javadoc is part of the Solr javadoc, which is part of the Lucene javadoc. Here are the public javadoc pages for a few of the parts of SolrJ: http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/client/solrj/SolrQuery.html http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrServer.html http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/client/solrj/impl/CloudSolrServer.html lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/client/solrj/response/QueryResponse.html http://lucene.apache.org/solr/4_5_0/solr-solrj/org/apache/solr/common/util/NamedList.html I found these with Google, by searching for the class name with a version number - in this case 4.5 was the version number that I used. Starting at one of the URLs above, I clicked the "Tree" link at the top, then "All Packages" and got to this URL, which lists all the classes in the entire solrj source tree: http://lucene.apache.org/solr/4_5_0/solr-solrj/overview-tree.html There are also pages in the reference guide and on the wiki about SolrJ: https://cwiki.apache.org/confluence/display/solr/Using+SolrJ http://wiki.apache.org/solr/Solrj Thanks, Shawn