Interface SolrCollection
-
public interface SolrCollection
Represents a Collection in SolrCloud (unrelated toCollection
that uses the nicer name).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getCustomProperty(String customPropertyName)
Returns the value of a custom property name set on theSolrCollection
ornull
when no such property was set.String
getName()
The collection name (value passed toCluster.getCollection(String)
).Shard
getShard(String name)
Returns theShard
of the given name for that collection, if such a shard exists.Set<String>
getShardNames()
Iterator<Shard>
iterator()
Iterable<Shard>
shards()
Allow foreach iteration on shards such as:for (Shard s : solrCollection.shards()) {...}
.
-
-
-
Method Detail
-
getName
String getName()
The collection name (value passed toCluster.getCollection(String)
).
-
getShard
Shard getShard(String name)
Returns theShard
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 (seePlacementRequest.getShardNames()
. Non existing shards will not be returned by this method. Only shards already existing will be returned.- Returns:
null
if the shard does not or does not yet exist for the collection.
-
iterator
Iterator<Shard> iterator()
- Returns:
- an iterator over
Shard
s of thisSolrCollection
.
-
shards
Iterable<Shard> shards()
Allow foreach iteration on shards such as:for (Shard s : solrCollection.shards()) {...}
.
-
getShardNames
Set<String> 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
String getCustomProperty(String customPropertyName)
Returns the value of a custom property name set on theSolrCollection
ornull
when no such property was set. Properties are set through the Collection API. See for exampleMODIFYCOLLECTION
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 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.
-
-