Interface SolrCollection
Collection that uses the
nicer name).-
Method Summary
Modifier and TypeMethodDescriptiongetCustomProperty(String customPropertyName) Returns the value of a custom property name set on theSolrCollectionornullwhen no such property was set.getName()The collection name (value passed toCluster.getCollection(String)).Returns theShardof the given name for that collection, if such a shard exists.iterator()shards()Allow foreach iteration on shards such as:for (Shard s : solrCollection.shards()) {...}.
-
Method Details
-
getName
String getName()The collection name (value passed toCluster.getCollection(String)). -
getShard
Returns theShardof 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 (seePlacementRequest.getShardNames(). Non existing shards will not be returned by this method. Only shards already existing will be returned.- Returns:
nullif the shard does not or does not yet exist for the collection.
-
iterator
- Returns:
- an iterator over
Shards of thisSolrCollection.
-
shards
Allow foreach iteration on shards such as:for (Shard s : solrCollection.shards()) {...}. -
getShardNames
- Returns:
- 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
Returns the value of a custom property name set on theSolrCollectionornullwhen no such property was set. Properties are set through the Collection API. See for exampleMODIFYCOLLECTIONin the Solr reference guide.PlacementPluginrelated note:Using custom properties in conjunction with ad hoc
PlacementPlugincode 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 thenAttributeFetcher.requestNodeSystemProperty(String)for that property from all nodes and only place replicas of this collection onNode's for which this attribute is non empty and equal.
-