Class DefaultSearchIndexOperations
java.lang.Object
org.springframework.data.mongodb.core.index.DefaultSearchIndexOperations
- All Implemented Interfaces:
SearchIndexOperations
- Since:
- 4.5
- Author:
- Christoph Strobl, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSearchIndexOperations
(MongoOperations mongoOperations, Class<?> type) DefaultSearchIndexOperations
(MongoOperations mongoOperations, String collectionName, Class<?> type) -
Method Summary
Modifier and TypeMethodDescriptioncreateIndex
(SearchIndexDefinition indexDefinition) Create the index for the givenSearchIndexDefinition
in the collection indicated by the entity class.void
Drops all search indices from the collection indicated by the entity class.void
Drops an index from the collection indicated by the entity class.boolean
Check whether an index with the givenindexName
exists for the collection indicated by the entity class.Check the actualstatus
of an index.void
updateIndex
(SearchIndexDefinition indexDefinition) Alters the search index matching the indexname
.
-
Constructor Details
-
DefaultSearchIndexOperations
-
DefaultSearchIndexOperations
public DefaultSearchIndexOperations(MongoOperations mongoOperations, String collectionName, @Nullable Class<?> type)
-
-
Method Details
-
createIndex
Description copied from interface:SearchIndexOperations
Create the index for the givenSearchIndexDefinition
in the collection indicated by the entity class.- Specified by:
createIndex
in interfaceSearchIndexOperations
- Parameters:
indexDefinition
- must not be null.- Returns:
- the index name.
-
updateIndex
Description copied from interface:SearchIndexOperations
Alters the search index matching the indexname
.Atlas Search might not support updating indices which raises a
DataAccessException
.- Specified by:
updateIndex
in interfaceSearchIndexOperations
- Parameters:
indexDefinition
- the index definition.
-
exists
Description copied from interface:SearchIndexOperations
Check whether an index with the givenindexName
exists for the collection indicated by the entity class. To ensure an existing index is queryable it is recommended to check itsstatus
.- Specified by:
exists
in interfaceSearchIndexOperations
- Parameters:
indexName
- name of index to check for presence.- Returns:
- true if the index exists; false otherwise.
-
status
Description copied from interface:SearchIndexOperations
Check the actualstatus
of an index.- Specified by:
status
in interfaceSearchIndexOperations
- Parameters:
indexName
- name of index to get the status for.- Returns:
- the current status of the index or
SearchIndexStatus.DOES_NOT_EXIST
if the index cannot be found.
-
dropAllIndexes
public void dropAllIndexes()Description copied from interface:SearchIndexOperations
Drops all search indices from the collection indicated by the entity class.- Specified by:
dropAllIndexes
in interfaceSearchIndexOperations
-
dropIndex
Description copied from interface:SearchIndexOperations
Drops an index from the collection indicated by the entity class.- Specified by:
dropIndex
in interfaceSearchIndexOperations
- Parameters:
indexName
- name of index to drop.
-