Interface IndexResolver
- All Known Implementing Classes:
MongoPersistentEntityIndexResolver
public interface IndexResolver
IndexResolver
finds those IndexDefinition
s to be created for a given class.
The IndexResolver
considers index annotations like Indexed
, GeoSpatialIndexed
,
HashIndexed
, TextIndexed
and WildcardIndexed
on properties as well as CompoundIndex
and WildcardIndexed
on types.
Unless specified otherwise the index name will be created out of the keys/path involved in the index.
TextIndexed
properties are collected into a single index that covers the detected fields.
Map
like structures, unless annotated with WildcardIndexed
, are skipped because the
map key
, which cannot be resolved from static metadata, needs to be part of the
index.
- Since:
- 1.5
- Author:
- Christoph Strobl, Thomas Darimont, Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionstatic IndexResolver
create
(MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) Creates a newIndexResolver
givenMongoMappingContext
.default Iterable<? extends IndexDefinition>
resolveIndexFor
(Class<?> entityType) Find and createIndexDefinition
s for properties of givenTypeInformation
.Iterable<? extends IndexDefinition>
resolveIndexFor
(TypeInformation<?> typeInformation) Find and createIndexDefinition
s for properties of givenTypeInformation
.
-
Method Details
-
create
static IndexResolver create(MappingContext<? extends MongoPersistentEntity<?>, MongoPersistentProperty> mappingContext) Creates a newIndexResolver
givenMongoMappingContext
.- Parameters:
mappingContext
- must not be null.- Returns:
- the new
IndexResolver
. - Since:
- 2.2
-
resolveIndexFor
Find and createIndexDefinition
s for properties of givenTypeInformation
.IndexDefinition
s are created for properties and types withIndexed
,CompoundIndexes
orGeoSpatialIndexed
.- Parameters:
typeInformation
- must not be null.- Returns:
- Empty
Iterable
in case noIndexDefinition
could be resolved for type.
-
resolveIndexFor
Find and createIndexDefinition
s for properties of givenTypeInformation
.IndexDefinition
s are created for properties and types withIndexed
,CompoundIndexes
orGeoSpatialIndexed
.- Parameters:
entityType
- must not be null.- Returns:
- Empty
Iterable
in case noIndexDefinition
could be resolved for type.
-