Enum SchemaManagementStrategyName
- java.lang.Object
-
- java.lang.Enum<SchemaManagementStrategyName>
-
- org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName
-
- All Implemented Interfaces:
Serializable
,Comparable<SchemaManagementStrategyName>
public enum SchemaManagementStrategyName extends Enum<SchemaManagementStrategyName>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CREATE
A strategy that creates missing indexes and their schema on startup, but does not touch existing indexes and assumes their schema is correct without validating it.CREATE_OR_UPDATE
A strategy that creates missing indexes and their schema on startup, and updates the schema of existing indexes if possible.CREATE_OR_VALIDATE
A strategy that creates missing indexes and their schema on startup, and validates the schema of existing indexes.DROP_AND_CREATE
A strategy that drops existing indexes and re-creates them and their schema on startup.DROP_AND_CREATE_AND_DROP
A strategy that drops existing indexes and re-creates them and their schema on startup, then drops the indexes on shutdown.NONE
A strategy that does not do anything on startup or shutdown.VALIDATE
A strategy that does not change indexes nor their schema, but checks that indexes exist and validates their schema on startup.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
externalRepresentation()
static SchemaManagementStrategyName
of(String value)
static SchemaManagementStrategyName
valueOf(String name)
Returns the enum constant of this type with the specified name.static SchemaManagementStrategyName[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NONE
public static final SchemaManagementStrategyName NONE
A strategy that does not do anything on startup or shutdown.Indexes and their schema will not be created nor deleted on startup or shutdown. Hibernate Search will not even check that the index actually exists.
With Elasticsearch, indexes and their schema will have to be created explicitly.
-
VALIDATE
public static final SchemaManagementStrategyName VALIDATE
A strategy that does not change indexes nor their schema, but checks that indexes exist and validates their schema on startup.An exception will be thrown on startup 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.
-
CREATE
public static final SchemaManagementStrategyName CREATE
A strategy that creates missing indexes and their schema on startup, but does not touch existing indexes and assumes their schema is correct without validating it.Note that creating indexes and their schema will not populate the indexed data: a newly created index will always be empty. To populate indexes with pre-existing data, use mass indexing.
-
CREATE_OR_VALIDATE
public static final SchemaManagementStrategyName CREATE_OR_VALIDATE
A strategy that creates missing indexes and their schema on startup, 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.
-
CREATE_OR_UPDATE
public static final SchemaManagementStrategyName CREATE_OR_UPDATE
A strategy that creates missing indexes and their schema on startup, 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: This strategy is unfit for production environments, due to the limitations explained below. It should only be relied upon during development, to easily add new fields to an existing index.
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.
-
DROP_AND_CREATE
public static final SchemaManagementStrategyName DROP_AND_CREATE
A strategy that drops existing indexes and re-creates them and their schema on startup.Note that dropping indexes means losing all indexed data, and creating indexes will not populate them: the newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
-
DROP_AND_CREATE_AND_DROP
public static final SchemaManagementStrategyName DROP_AND_CREATE_AND_DROP
A strategy that drops existing indexes and re-creates them and their schema on startup, then drops the indexes on shutdown.Note that dropping indexes means losing all indexed data, and creating indexes will not populate them: the newly created indexes will always be empty. To populate indexes with pre-existing data, use mass indexing.
-
-
Method Detail
-
values
public static SchemaManagementStrategyName[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SchemaManagementStrategyName c : SchemaManagementStrategyName.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SchemaManagementStrategyName valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
of
public static SchemaManagementStrategyName of(String value)
-
externalRepresentation
public String externalRepresentation()
- Returns:
- The expected string representation in configuration properties.
-
-