Class SearchSchemaManagerImpl
- java.lang.Object
-
- org.hibernate.search.mapper.orm.schema.management.impl.SearchSchemaManagerImpl
-
- All Implemented Interfaces:
SearchSchemaManager
public class SearchSchemaManagerImpl extends Object implements SearchSchemaManager
-
-
Constructor Summary
Constructors Constructor Description SearchSchemaManagerImpl(PojoScopeSchemaManager delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateIfMissing()Creates missing indexes and their schema, but does not touch existing indexes and assumes their schema is correct without validating it.voidcreateOrUpdate()Creates missing indexes and their schema, and updates the schema of existing indexes if possible.voidcreateOrValidate()Creates missing indexes and their schema, and validates the schema of existing indexes.voiddropAndCreate()Drops existing indexes and re-creates them and their schema.voiddropIfExisting()Drops existing indexes.voidexportExpectedSchema(Path targetDirectory)Exports the schema represented by this schema manager as a file tree created within the provided target directory.voidexportExpectedSchema(SearchSchemaCollector collector)Accepts a collector that walks through schema exports created from indexes represented by this schema manager.voidvalidate()Does not change indexes nor their schema, but checks that indexes exist and validates their schema.
-
-
-
Constructor Detail
-
SearchSchemaManagerImpl
public SearchSchemaManagerImpl(PojoScopeSchemaManager delegate)
-
-
Method Detail
-
validate
public void validate()
Description copied from interface:SearchSchemaManagerDoes not change indexes nor their schema, but checks that indexes exist and validates their schema.An exception will be thrown if:
- Indexes are missing
- OR, with Elasticsearch only, indexes exist but their schema does not match the requirements of the Hibernate Search mapping: missing fields, fields with incorrect type, missing analyzer definitions or normalizer definitions, ...
Warning: with the Lucene backend, validation is limited to checking that the indexes exist, because local Lucene indexes don't have a schema.
- Specified by:
validatein interfaceSearchSchemaManager
-
createIfMissing
public void createIfMissing()
Description copied from interface:SearchSchemaManagerCreates missing indexes and their schema, but does not touch existing indexes and assumes their schema is correct without validating it.Note that creating indexes or updating their schema will not populate or update the indexed data: a newly created index will always be empty. To populate indexes with pre-existing data, use mass indexing.
- Specified by:
createIfMissingin interfaceSearchSchemaManager
-
createOrValidate
public void createOrValidate()
Description copied from interface:SearchSchemaManagerCreates missing indexes and their schema, and validates the schema of existing indexes.Note that creating indexes and their schema will not populate the indexed data: newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
With Elasticsearch only, an exception will be thrown on startup if some indexes already exist but their schema does not match the requirements of the Hibernate Search mapping: missing fields, fields with incorrect type, missing analyzer definitions or normalizer definitions, ...
Warning: with the Lucene backend, validation is limited to checking that the indexes exist, because local Lucene indexes don't have a schema.
- Specified by:
createOrValidatein interfaceSearchSchemaManager
-
createOrUpdate
public void createOrUpdate()
Description copied from interface:SearchSchemaManagerCreates missing indexes and their schema, and updates the schema of existing indexes if possible.Note that creating indexes or updating their schema will not populate or update the indexed data: newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
Note: with the Lucene backend, schema update is a no-op, because local Lucene indexes don't have a schema.
Warning: with the Elasticsearch backend, if analyzer/normalizer definitions have to be updated, the index will be closed automatically during the update.
Warning: with the Elasticsearch backend, many scenarios can cause schema updates to fail: a field changed its type from string to integer, an analyzer definition changed, ... In such cases, the only workaround is to drop and re-create the index.
- Specified by:
createOrUpdatein interfaceSearchSchemaManager
-
dropIfExisting
public void dropIfExisting()
Description copied from interface:SearchSchemaManagerDrops existing indexes.Note that dropping indexes means losing all indexed data.
- Specified by:
dropIfExistingin interfaceSearchSchemaManager
-
dropAndCreate
public void dropAndCreate()
Description copied from interface:SearchSchemaManagerDrops existing indexes and re-creates them and their schema.Note that dropping indexes means losing all indexed data, and creating indexes will not populate them: the newly created index will always be empty. To populate indexes with pre-existing data, use mass indexing.
- Specified by:
dropAndCreatein interfaceSearchSchemaManager
-
exportExpectedSchema
public void exportExpectedSchema(SearchSchemaCollector collector)
Description copied from interface:SearchSchemaManagerAccepts a collector that walks through schema exports created from indexes represented by this schema manager.- Specified by:
exportExpectedSchemain interfaceSearchSchemaManager- See Also:
SearchSchemaCollector
-
exportExpectedSchema
public void exportExpectedSchema(Path targetDirectory)
Description copied from interface:SearchSchemaManagerExports the schema represented by this schema manager as a file tree created within the provided target directory.- Specified by:
exportExpectedSchemain interfaceSearchSchemaManager- Parameters:
targetDirectory- The target directory to generate the output into.
-
-