Interface SolrCollection

  • public interface SolrCollection
    Represents a Collection in SolrCloud (unrelated to Collection that uses the nicer name).
    • Method Detail

      • getShard

        Shard getShard​(String name)
        Returns the Shard of the given name for that collection, if such a shard exists.

        Note that when a request for adding replicas for a collection is received by a PlacementPlugin, it is possible that replicas need to be added to non existing shards (see PlacementRequest.getShardNames(). Non existing shards will not be returned by this method. Only shards already existing will be returned.

        null if the shard does not or does not yet exist for the collection.
      • shards

        Iterable<Shard> shards()
        Allow foreach iteration on shards such as: for (Shard s : solrCollection.shards()) {...}.
      • getShardNames

        Set<String> getShardNames()
        a set of the names of the shards defined for this collection. This set is backed by an internal map so should not be modified.
      • getCustomProperty

        String getCustomProperty​(String customPropertyName)
        Returns the value of a custom property name set on the SolrCollection or null when no such property was set. Properties are set through the Collection API. See for example MODIFYCOLLECTION in the Solr reference guide.

        PlacementPlugin related note:

        Using custom properties in conjunction with ad hoc PlacementPlugin code allows customizing placement decisions per collection.

        For example if a collection is to be placed only on nodes using located in a specific availability zone, it can be identified as such using some custom property (collection property could for example be called "availabilityZone" and have value "az1" in that case), and the placement plugin (implementing PlacementPlugin) would then AttributeFetcher.requestNodeSystemProperty(String) for that property from all nodes and only place replicas of this collection on Node's for which this attribute is non empty and equal.