Class DiscriminatorTypeNameMapping
- java.lang.Object
-
- org.hibernate.search.backend.elasticsearch.mapping.impl.DiscriminatorTypeNameMapping
-
- All Implemented Interfaces:
TypeNameMapping
public class DiscriminatorTypeNameMapping extends Object implements TypeNameMapping
Rely on a discriminator field added to each document to resolve the type name. Works correctly with index aliases.
-
-
Constructor Summary
Constructors Constructor Description DiscriminatorTypeNameMapping()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<DocumentMetadataContributor>getDocumentMetadataContributor(String mappedTypeName)Optional<ImplicitFieldContributor>getImplicitFieldContributor()Optional<IndexSchemaRootContributor>getIndexSchemaRootContributor()ProjectionExtractionHelper<String>getTypeNameExtractionHelper()voidregister(IndexNames indexNames, String mappedTypeName)Register a new index => type mapping.
-
-
-
Method Detail
-
getIndexSchemaRootContributor
public Optional<IndexSchemaRootContributor> getIndexSchemaRootContributor()
- Specified by:
getIndexSchemaRootContributorin interfaceTypeNameMapping- Returns:
- A schema contributor for the required additional properties (type name, ...), or an empty optional.
-
getDocumentMetadataContributor
public Optional<DocumentMetadataContributor> getDocumentMetadataContributor(String mappedTypeName)
- Specified by:
getDocumentMetadataContributorin interfaceTypeNameMapping- Parameters:
mappedTypeName- The name of the type mapped to the index.- Returns:
- A document metadata contributor for the required additional properties (type name, ...), or an empty optional.
-
getImplicitFieldContributor
public Optional<ImplicitFieldContributor> getImplicitFieldContributor()
- Specified by:
getImplicitFieldContributorin interfaceTypeNameMapping- Returns:
- A field contributor for the additional implicit properties (_entity_type, ...), or an empty optional.
-
register
public void register(IndexNames indexNames, String mappedTypeName)
Description copied from interface:TypeNameMappingRegister a new index => type mapping.- Specified by:
registerin interfaceTypeNameMapping- Parameters:
indexNames- The names of the index.mappedTypeName- The name of the type mapped to the index.
-
getTypeNameExtractionHelper
public ProjectionExtractionHelper<String> getTypeNameExtractionHelper()
- Specified by:
getTypeNameExtractionHelperin interfaceTypeNameMapping- Returns:
- A helper for projections that need to extract the mapped type name from search hits.
-
-