3030import org .apache .solr .client .solrj .SolrClient ;
3131import org .apache .solr .client .solrj .SolrRequest ;
3232import org .apache .solr .client .solrj .SolrServerException ;
33- import org .apache .solr .client .solrj .impl .CloudSolrClient ;
3433import org .apache .solr .client .solrj .request .CollectionAdminRequest ;
35- import org .apache .solr .client .solrj .request .CoreAdminRequest ;
3634import org .apache .solr .client .solrj .request .GenericSolrRequest ;
3735import org .apache .solr .client .solrj .request .LukeRequest ;
3836import org .apache .solr .client .solrj .request .SolrQuery ;
3937import org .apache .solr .client .solrj .response .CollectionAdminResponse ;
40- import org .apache .solr .client .solrj .response .CoreAdminResponse ;
4138import org .apache .solr .client .solrj .response .LukeResponse ;
4239import org .apache .solr .client .solrj .response .QueryResponse ;
4340import org .apache .solr .client .solrj .response .SolrPingResponse ;
44- import org .apache .solr .common .params .CoreAdminParams ;
4541import org .apache .solr .common .params .ModifiableSolrParams ;
4642import org .apache .solr .common .util .NamedList ;
4743import org .apache .solr .mcp .server .config .SolrConfigurationProperties ;
6763 * <strong>Core Capabilities:</strong>
6864 *
6965 * <ul>
70- * <li><strong>Collection Discovery</strong>: Lists available collections with
71- * automatic SolrCloud vs standalone detection
66+ * <li><strong>Collection Discovery</strong>: Lists available collections using
67+ * the SolrCloud Collections API
7268 * <li><strong>Performance Monitoring</strong>: Comprehensive metrics collection
7369 * including index, query, cache, and handler statistics
7470 * <li><strong>Health Monitoring</strong>: Real-time health checks with
10096 *
10197 * <ul>
10298 * <li><strong>SolrCloud</strong>: Distributed mode using Collections API
103- * <li><strong>Standalone</strong>: Single-node mode using Core Admin API
10499 * </ul>
105100 *
106101 * <p>
126121 * SolrHealthStatus health = collectionService.checkHealth("my_collection");
127122 * }</pre>
128123 *
129- * @version 1.0.0
130- * @since 1.0.0
131124 * @see SolrMetrics
132125 * @see SolrHealthStatus
133126 * @see org.apache.solr.client.solrj.SolrClient
@@ -319,23 +312,16 @@ public List<String> completeCollectionForSchema() {
319312 }
320313
321314 /**
322- * Lists all available Solr collections in the cluster.
315+ * Lists all available Solr collections in the SolrCloud cluster.
323316 *
324317 * <p>
325- * This method automatically detects the Solr deployment type and uses the
326- * appropriate API:
327- *
328- * <ul>
329- * <li><strong>SolrCloud</strong>: Uses Collections API to list distributed
330- * collections
331- * <li><strong>Standalone</strong>: Uses Core Admin API to list individual
332- * collections
333- * </ul>
318+ * This method uses the SolrCloud Collections API to retrieve the list of
319+ * available collections. Standalone Solr instances are not supported.
334320 *
335321 * <p>
336- * In SolrCloud environments, the returned names may include shard identifiers
337- * (e.g., "films_shard1_replica_n1"). Use {@link #extractCollectionName(String)}
338- * to get the base collection name if needed.
322+ * The returned names may include shard identifiers (e.g.,
323+ * "films_shard1_replica_n1"). Use {@link #extractCollectionName(String)} to get
324+ * the base collection name if needed.
339325 *
340326 * <p>
341327 * <strong>Error Handling:</strong>
@@ -356,27 +342,16 @@ public List<String> completeCollectionForSchema() {
356342 * @return a list of collection names, or an empty list if unable to retrieve
357343 * them
358344 * @see CollectionAdminRequest.List
359- * @see CoreAdminRequest
360345 */
361346 @ McpTool (name = "list-collections" , description = "List solr collections" )
362347 public List <String > listCollections () {
363348 try {
364- if (solrClient instanceof CloudSolrClient ) {
365- // For SolrCloud - use Collections API
366- CollectionAdminRequest .List request = new CollectionAdminRequest .List ();
367- CollectionAdminResponse response = request .process (solrClient );
349+ CollectionAdminRequest .List request = new CollectionAdminRequest .List ();
350+ CollectionAdminResponse response = request .process (solrClient );
368351
369- @ SuppressWarnings ("unchecked" )
370- List <String > collections = (List <String >) response .getResponse ().get (COLLECTIONS_KEY );
371- return collections != null ? collections : new ArrayList <>();
372- } else {
373- // For standalone Solr - use Core Admin API
374- CoreAdminRequest coreAdminRequest = new CoreAdminRequest ();
375- coreAdminRequest .setAction (CoreAdminParams .CoreAdminAction .STATUS );
376- CoreAdminResponse coreResponse = coreAdminRequest .process (solrClient );
377-
378- return new ArrayList <>(coreResponse .getCoreStatus ().keySet ());
379- }
352+ @ SuppressWarnings ("unchecked" )
353+ List <String > collections = (List <String >) response .getResponse ().get (COLLECTIONS_KEY );
354+ return collections != null ? collections : new ArrayList <>();
380355 } catch (SolrServerException | IOException _) {
381356 return new ArrayList <>();
382357 }
@@ -951,9 +926,8 @@ String extractCollectionName(String collectionOrShard) {
951926 * </ol>
952927 *
953928 * <p>
954- * This dual approach ensures compatibility with both standalone Solr (which
955- * returns collection names directly) and SolrCloud (which may return shard
956- * names).
929+ * This dual approach ensures compatibility with SolrCloud environments where
930+ * shard names may be returned alongside collection names.
957931 *
958932 * <p>
959933 * <strong>Error Handling:</strong>
0 commit comments