Module spring.data.mongodb
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 givenSearchIndexDefinitionin the collection indicated by the entity class.voidDrops all search indices from the collection indicated by the entity class.voidDrops an index from the collection indicated by the entity class.booleanCheck whether an index with the givenindexNameexists for the collection indicated by the entity class.Check the actualstatusof an index.voidupdateIndex(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:SearchIndexOperationsCreate the index for the givenSearchIndexDefinitionin the collection indicated by the entity class.- Specified by:
createIndexin interfaceSearchIndexOperations- Parameters:
indexDefinition- must not be null.- Returns:
- the index name.
-
updateIndex
Description copied from interface:SearchIndexOperationsAlters the search index matching the indexname.Atlas Search might not support updating indices which raises a
DataAccessException.- Specified by:
updateIndexin interfaceSearchIndexOperations- Parameters:
indexDefinition- the index definition.
-
exists
Description copied from interface:SearchIndexOperationsCheck whether an index with the givenindexNameexists for the collection indicated by the entity class. To ensure an existing index is queryable it is recommended to check itsstatus.- Specified by:
existsin interfaceSearchIndexOperations- Parameters:
indexName- name of index to check for presence.- Returns:
- true if the index exists; false otherwise.
-
status
Description copied from interface:SearchIndexOperationsCheck the actualstatusof an index.- Specified by:
statusin interfaceSearchIndexOperations- Parameters:
indexName- name of index to get the status for.- Returns:
- the current status of the index or
SearchIndexStatus.DOES_NOT_EXISTif the index cannot be found.
-
dropAllIndexes
public void dropAllIndexes()Description copied from interface:SearchIndexOperationsDrops all search indices from the collection indicated by the entity class.- Specified by:
dropAllIndexesin interfaceSearchIndexOperations
-
dropIndex
Description copied from interface:SearchIndexOperationsDrops an index from the collection indicated by the entity class.- Specified by:
dropIndexin interfaceSearchIndexOperations- Parameters:
indexName- name of index to drop.
-