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 Details

  • Method Details

    • validate

      public void validate()
      Description copied from interface: SearchSchemaManager
      Does 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:
      validate in interface SearchSchemaManager
    • createIfMissing

      public void createIfMissing()
      Description copied from interface: SearchSchemaManager
      Creates 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:
      createIfMissing in interface SearchSchemaManager
    • createOrValidate

      public void createOrValidate()
      Description copied from interface: SearchSchemaManager
      Creates 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:
      createOrValidate in interface SearchSchemaManager
    • createOrUpdate

      public void createOrUpdate()
      Description copied from interface: SearchSchemaManager
      Creates 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:
      createOrUpdate in interface SearchSchemaManager
    • dropIfExisting

      public void dropIfExisting()
      Description copied from interface: SearchSchemaManager
      Drops existing indexes.

      Note that dropping indexes means losing all indexed data.

      Specified by:
      dropIfExisting in interface SearchSchemaManager
    • dropAndCreate

      public void dropAndCreate()
      Description copied from interface: SearchSchemaManager
      Drops 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:
      dropAndCreate in interface SearchSchemaManager
    • exportExpectedSchema

      public void exportExpectedSchema(SearchSchemaCollector collector)
      Description copied from interface: SearchSchemaManager
      Accepts a collector that walks through schema exports created from indexes represented by this schema manager.
      Specified by:
      exportExpectedSchema in interface SearchSchemaManager
      See Also:
    • exportExpectedSchema

      public void exportExpectedSchema(Path targetDirectory)
      Description copied from interface: SearchSchemaManager
      Exports the schema represented by this schema manager as a file tree created within the provided target directory.
      Specified by:
      exportExpectedSchema in interface SearchSchemaManager
      Parameters:
      targetDirectory - The target directory to generate the output into.