Class StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder
- Enclosing class:
- StaticAttributesGroupConfiguration
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FieldConfigurationprotected FieldMappingStrategyprotected Class<? extends FieldMappingStrategy>protected static final com.fasterxml.jackson.databind.ObjectMapperprotected Integerprotected PropertyValueExtractor -
Constructor Summary
Constructors -
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) DefinesFieldMappingStrategyinstance that should be used to map properties.withFieldMappingStrategyClass(Class<? extends FieldMappingStrategy> fieldMappingStrategyClass) DefinesFieldMappingStrategyimplementation class that should be used to map properties.withOrder(int order) Defines explicit order of theMappingDefinitionfor the field.withParameters(Map<String, Object> parameters) Defines parameters map.withPropertyValueExtractor(PropertyValueExtractor propertyValueExtractor) Defines explicitPropertyValueExtractorthat should be used to extract values from indexed properties.
-
Field Details
-
mapper
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper -
fieldMappingStrategyClass
-
fieldMappingStrategy
-
fieldConfiguration
-
propertyValueExtractor
-
parameters
-
order
-
-
Constructor Details
-
StaticAttributeGroupBuilder
protected StaticAttributeGroupBuilder()
-
-
Method Details
-
includeProperties
public StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder 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 StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder 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 StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder withFieldMappingStrategyClass(Class<? extends FieldMappingStrategy> fieldMappingStrategyClass) DefinesFieldMappingStrategyimplementation class that should be used to map properties.Optional - at least one of the followings should be defined:
FieldMappingStrategyimplementation class via this methodFieldMappingStrategyinstance 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 StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder withFieldMappingStrategy(FieldMappingStrategy fieldMappingStrategy) DefinesFieldMappingStrategyinstance that should be used to map properties.Optional - at least one of the followings should be defined:
FieldMappingStrategyimplementation class viawithFieldMappingStrategyClass(java.lang.Class<? extends io.jmix.search.index.mapping.strategy.FieldMappingStrategy>)methodFieldMappingStrategyinstance 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-FieldMappingStrategyinstance- Returns:
- builder
- See Also:
-
withParameters
public StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder withParameters(Map<String, Object> parameters) Defines parameters map.- Parameters:
parameters- parameters- Returns:
- builder
-
addParameter
public StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder addParameter(String parameterName, Object parameterValue) Adds new parameter to parameters map.- Parameters:
parameterName- parameter nameparameterValue- parameter value- Returns:
- builder
-
withFieldConfiguration
public StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder 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:
FieldMappingStrategyimplementation class viawithFieldMappingStrategyClass(java.lang.Class<? extends io.jmix.search.index.mapping.strategy.FieldMappingStrategy>)methodFieldMappingStrategyinstance 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 StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder 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:
FieldMappingStrategyimplementation class viawithFieldMappingStrategyClass(java.lang.Class<? extends io.jmix.search.index.mapping.strategy.FieldMappingStrategy>)methodFieldMappingStrategyinstance 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 StaticAttributesGroupConfiguration.StaticAttributeGroupBuilder withPropertyValueExtractor(PropertyValueExtractor propertyValueExtractor) Defines explicitPropertyValueExtractorthat should be used to extract values from indexed properties.Required if only explicit field configuration is defined.
Optional if
FieldMappingStrategyis 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 of theMappingDefinitionfor the field. TheMappingDefinitionwith the highest order number will be applied. If the order is not specifiedInteger.MIN_VALUEwill be used. It overrides order on strategy -FieldMappingStrategy.getOrder(). If twoMappingDefinitionobjects have the same order the runtime error during the application initialization will occur.- Parameters:
order- the order value to be set for the fields of this descriptor- Returns:
- builder
-
build
-