7
7
package org .hibernate .search .mapper .pojo .standalone .cfg ;
8
8
9
9
import org .hibernate .search .engine .environment .bean .BeanReference ;
10
+ import org .hibernate .search .mapper .pojo .mapping .definition .annotation .ProjectionConstructor ;
11
+ import org .hibernate .search .mapper .pojo .mapping .definition .annotation .SearchEntity ;
12
+ import org .hibernate .search .mapper .pojo .mapping .definition .annotation .processing .RootMapping ;
10
13
import org .hibernate .search .mapper .pojo .standalone .mapping .SearchMapping ;
11
14
import org .hibernate .search .mapper .pojo .standalone .mapping .StandalonePojoMappingConfigurer ;
12
15
import org .hibernate .search .mapper .pojo .standalone .schema .management .SchemaManagementStrategyName ;
@@ -36,6 +39,43 @@ private StandalonePojoMapperSettings() {
36
39
*/
37
40
public static final String SCHEMA_MANAGEMENT_STRATEGY = PREFIX + Radicals .SCHEMA_MANAGEMENT_STRATEGY ;
38
41
42
+ /**
43
+ * Whether Hibernate Search should automatically build Jandex indexes for types registered for annotation processing
44
+ * (entities in particular),
45
+ * to ensure that all "root mapping" annotations in those JARs (e.g. {@link org.hibernate.search.mapper.pojo.mapping.definition.annotation.ProjectionConstructor})
46
+ * are taken into account.
47
+ * <p>
48
+ * Expects a Boolean value such as {@code true} or {@code false},
49
+ * or a string that can be parsed into a Boolean value.
50
+ * <p>
51
+ * Defaults to {@link Defaults#MAPPING_BUILD_MISSING_DISCOVERED_JANDEX_INDEXES}.
52
+ *
53
+ * @see org.hibernate.search.mapper.pojo.mapping.definition.annotation.AnnotationMappingConfigurationContext#buildMissingDiscoveredJandexIndexes(boolean)
54
+ */
55
+ public static final String MAPPING_BUILD_MISSING_DISCOVERED_JANDEX_INDEXES =
56
+ PREFIX + Radicals .MAPPING_BUILD_MISSING_DISCOVERED_JANDEX_INDEXES ;
57
+
58
+ /**
59
+ * Whether Hibernate Search should automatically discover annotated types
60
+ * present in the Jandex index that are also annotated
61
+ * with {@link RootMapping root mapping annotations}.
62
+ * <p>
63
+ * When enabled, if an annotation meta-annotated with {@link RootMapping}
64
+ * is found in the Jandex index,
65
+ * and a type annotated with that annotation (e.g. {@link SearchEntity} or {@link ProjectionConstructor}) is found in the Jandex index,
66
+ * then that type will automatically be scanned for mapping annotations,
67
+ * even if the type wasn't explicitly added.
68
+ * <p>
69
+ * Expects a Boolean value such as {@code true} or {@code false},
70
+ * or a string that can be parsed into a Boolean value.
71
+ * <p>
72
+ * Defaults to {@link Defaults#MAPPING_DISCOVER_ANNOTATED_TYPES_FROM_ROOT_MAPPING_ANNOTATIONS}.
73
+ *
74
+ * @see org.hibernate.search.mapper.pojo.mapping.definition.annotation.AnnotationMappingConfigurationContext#discoverAnnotatedTypesFromRootMappingAnnotations(boolean)
75
+ */
76
+ public static final String MAPPING_DISCOVER_ANNOTATED_TYPES_FROM_ROOT_MAPPING_ANNOTATIONS =
77
+ PREFIX + Radicals .MAPPING_DISCOVER_ANNOTATED_TYPES_FROM_ROOT_MAPPING_ANNOTATIONS ;
78
+
39
79
/**
40
80
* A configurer for the Hibernate Search mapping.
41
81
* <p>
@@ -95,10 +135,15 @@ private Radicals() {
95
135
}
96
136
97
137
public static final String SCHEMA_MANAGEMENT_STRATEGY = "schema_management.strategy" ;
98
- public static final String MAPPING_CONFIGURER = "mapping.configurer" ;
99
- public static final String MULTI_TENANCY_ENABLED = "mapping.multi_tenancy.enabled" ;
138
+ public static final String MAPPING_PREFIX = "mapping." ;
139
+ public static final String MAPPING_BUILD_MISSING_DISCOVERED_JANDEX_INDEXES =
140
+ MAPPING_PREFIX + "build_missing_discovered_jandex_indexes" ;
141
+ public static final String MAPPING_DISCOVER_ANNOTATED_TYPES_FROM_ROOT_MAPPING_ANNOTATIONS =
142
+ MAPPING_PREFIX + "discover_annotated_types_from_root_mapping_annotations" ;
143
+ public static final String MAPPING_CONFIGURER = MAPPING_PREFIX + "configurer" ;
144
+ public static final String MULTI_TENANCY_ENABLED = MAPPING_PREFIX + "multi_tenancy.enabled" ;
100
145
public static final String MULTI_TENANCY_TENANT_IDENTIFIER_CONVERTER =
101
- "mapping. multi_tenancy.tenant_identifier_converter" ;
146
+ MAPPING_PREFIX + " multi_tenancy.tenant_identifier_converter" ;
102
147
public static final String INDEXING_PLAN_SYNCHRONIZATION_PREFIX = "indexing.plan.synchronization." ;
103
148
public static final String INDEXING_PLAN_SYNCHRONIZATION_STRATEGY = INDEXING_PLAN_SYNCHRONIZATION_PREFIX + "strategy" ;
104
149
@@ -114,6 +159,8 @@ private Defaults() {
114
159
115
160
public static final SchemaManagementStrategyName SCHEMA_MANAGEMENT_STRATEGY =
116
161
SchemaManagementStrategyName .CREATE_OR_VALIDATE ;
162
+ public static final boolean MAPPING_BUILD_MISSING_DISCOVERED_JANDEX_INDEXES = true ;
163
+ public static final boolean MAPPING_DISCOVER_ANNOTATED_TYPES_FROM_ROOT_MAPPING_ANNOTATIONS = true ;
117
164
public static final boolean MULTI_TENANCY_ENABLED = false ;
118
165
119
166
public static final BeanReference <IndexingPlanSynchronizationStrategy > INDEXING_PLAN_SYNCHRONIZATION_STRATEGY =
0 commit comments