Class MappingDefinitionElement.MappingDefinitionElementBuilder
- Enclosing class:
- MappingDefinitionElement
-
Method Summary
Modifier and TypeMethodDescriptionaddParameter
(String parameterName, Object parameterValue) Adds new parameter to parameters map.build()
excludeProperties
(String... properties) Defines entity properties that should NOT be indexed.includeProperties
(String... properties) Defines entity properties that should be indexed.withFieldConfiguration
(com.fasterxml.jackson.databind.node.ObjectNode configuration) Defines field configuration as json object with native configuration.withFieldConfiguration
(String configuration) Defines field configuration as String json object with native configuration.withFieldMappingStrategy
(FieldMappingStrategy fieldMappingStrategy) DefinesFieldMappingStrategy
instance that should be used to map properties.withFieldMappingStrategyClass
(Class<? extends FieldMappingStrategy> fieldMappingStrategyClass) DefinesFieldMappingStrategy
implementation class that should be used to map properties.withOrder
(int order) Defines explicit order.withParameters
(Map<String, Object> parameters) Defines parameters map.withPropertyValueExtractor
(PropertyValueExtractor propertyValueExtractor) Defines explicitPropertyValueExtractor
that should be used to extract values from indexed properties.
-
Method Details
-
includeProperties
public MappingDefinitionElement.MappingDefinitionElementBuilder includeProperties(String... properties) Defines entity properties that should be indexed.Properties should be defined in a full-name format started from the root entity ("localPropertyName", "refPropertyName.propertyName").
Wildcard is allowed at the last level of multilevel properties ("*", "refPropertyName.*").
- Parameters:
properties
- property names- Returns:
- builder
-
excludeProperties
public MappingDefinitionElement.MappingDefinitionElementBuilder excludeProperties(String... properties) Defines entity properties that should NOT be indexed.Properties should be defined in a full-name format started from the root entity ("localPropertyName", "refPropertyName.propertyName").
Wildcard is allowed at the last level of multilevel properties ("*", "refPropertyName.*").
- Parameters:
properties
- property names- Returns:
- builder
-
withFieldMappingStrategyClass
public MappingDefinitionElement.MappingDefinitionElementBuilder withFieldMappingStrategyClass(Class<? extends FieldMappingStrategy> fieldMappingStrategyClass) DefinesFieldMappingStrategy
implementation class that should be used to map properties.Optional - at least one of the followings should be defined:
FieldMappingStrategy
implementation class via this methodFieldMappingStrategy
instance viawithFieldMappingStrategy(io.jmix.search.index.mapping.strategy.FieldMappingStrategy)
method- Explicit native configuration via
withFieldConfiguration(java.lang.String)
methods
If some of them are defined at the same time:
- Strategy instance takes precedence over strategy class
- Explicit configuration overrides identical parameters of configuration generated by strategy
- Parameters:
fieldMappingStrategyClass
- class implementsFieldMappingStrategy
- Returns:
- builder
- See Also:
-
withFieldMappingStrategy
public MappingDefinitionElement.MappingDefinitionElementBuilder withFieldMappingStrategy(FieldMappingStrategy fieldMappingStrategy) DefinesFieldMappingStrategy
instance that should be used to map properties.Optional - at least one of the followings should be defined:
FieldMappingStrategy
implementation class viawithFieldMappingStrategyClass(java.lang.Class<? extends io.jmix.search.index.mapping.strategy.FieldMappingStrategy>)
methodFieldMappingStrategy
instance via this method- Explicit native configuration via
withFieldConfiguration(java.lang.String)
methods
If some of them are defined at the same time:
- Strategy instance takes precedence over strategy class
- Explicit configuration overrides identical parameters of configuration generated by strategy
- Parameters:
fieldMappingStrategy
-FieldMappingStrategy
instance- Returns:
- builder
- See Also:
-
withParameters
public MappingDefinitionElement.MappingDefinitionElementBuilder withParameters(Map<String, Object> parameters) Defines parameters map.- Parameters:
parameters
- parameters- Returns:
- builder
-
addParameter
public MappingDefinitionElement.MappingDefinitionElementBuilder addParameter(String parameterName, Object parameterValue) Adds new parameter to parameters map.- Parameters:
parameterName
- parameter nameparameterValue
- parameter value- Returns:
- builder
-
withFieldConfiguration
public MappingDefinitionElement.MappingDefinitionElementBuilder withFieldConfiguration(String configuration) Defines field configuration as String json object with native configuration. It should contain only configuration itself without field name:{ "type": "text", "analyzer": "english", "boost": 2 }
Optional - at least one of the followings should be defined:
FieldMappingStrategy
implementation class viawithFieldMappingStrategyClass(java.lang.Class<? extends io.jmix.search.index.mapping.strategy.FieldMappingStrategy>)
methodFieldMappingStrategy
instance viawithFieldMappingStrategy(io.jmix.search.index.mapping.strategy.FieldMappingStrategy)
method- Explicit native configuration via
withFieldConfiguration(java.lang.String)
methods
If some of them are defined at the same time:
- Strategy instance takes precedence over strategy class
- Explicit configuration overrides identical parameters of configuration generated by strategy
- Parameters:
configuration
- configuration as json string- Returns:
- builder
- Throws:
RuntimeException
- if provided string is not a well-formed json object- See Also:
-
withFieldConfiguration
public MappingDefinitionElement.MappingDefinitionElementBuilder withFieldConfiguration(com.fasterxml.jackson.databind.node.ObjectNode configuration) Defines field configuration as json object with native configuration. It should contain only configuration itself without field name:{ "type": "text", "analyzer": "english", "boost": 2 }
Optional - at least one of the followings should be defined:
FieldMappingStrategy
implementation class viawithFieldMappingStrategyClass(java.lang.Class<? extends io.jmix.search.index.mapping.strategy.FieldMappingStrategy>)
methodFieldMappingStrategy
instance viawithFieldMappingStrategy(io.jmix.search.index.mapping.strategy.FieldMappingStrategy)
method- Explicit native configuration via
withFieldConfiguration(java.lang.String)
methods
If some of them are defined at the same time:
- Strategy instance takes precedence over strategy class
- Explicit configuration overrides identical parameters of configuration generated by strategy
- Parameters:
configuration
- configuration as json object- Returns:
- builder
- See Also:
-
withPropertyValueExtractor
public MappingDefinitionElement.MappingDefinitionElementBuilder withPropertyValueExtractor(PropertyValueExtractor propertyValueExtractor) Defines explicitPropertyValueExtractor
that should be used to extract values from indexed properties.Required if only explicit field configuration is defined.
Optional if
FieldMappingStrategy
is defined (class or instance) - explicit extractor takes precedence over extractor provided by strategy.- Parameters:
propertyValueExtractor
- property value extractor- Returns:
- builder
- See Also:
-
withOrder
Defines explicit order. It overrides order on strategy -FieldMappingStrategy.getOrder()
.- Parameters:
order
- order- Returns:
- builder
-
build
-