@@ -67,25 +67,45 @@ to look for types annotated with
67
67
<<mapping-classpath-scanning-basics,root mapping annotations>> in the given Jandex index.
68
68
69
69
[[mapping-classpath-scanning-faster]]
70
- === [[mapper-orm-mapping-configuration-scanning-faster]] Faster scanning
71
-
72
- Hibernate Search's scanning may trigger the indexing of JARs through Jandex on application startup.
73
- This indexing should be reasonably short, but if it causes performance issues, you can:
74
-
75
- * Migrate your application to the <<compatibility-framework-quarkus,Quarkus>> framework,
76
- which among other things executes this part of Hibernate Search's startup at build time.
77
- * OR migrate your application to the <<compatibility-framework-wildfly,WildFly>> application server,
78
- which among other things executes this part of Hibernate Search's startup in a more optimized way.
79
- * OR execute the https://smallrye.io/jandex/[Jandex] Maven Plugin
80
- during the build of your application, so that indexes are already built when the application starts.
81
- * OR instruct Hibernate Search to never build Jandex indexes on startup,
82
- by setting the configuration property
83
- `hibernate.search.mapping.build_missing_discovered_jandex_indexes` to `false`.
84
- **This is not recommended as it may lead to bootstrap failures or ignored mapping annotations**
70
+ === [[mapper-orm-mapping-configuration-scanning-faster]] Configuring scanning
71
+
72
+ Hibernate Search’s scanning may trigger the indexing of JARs through Jandex on application startup.
73
+ In some of the more complicated environments,
74
+ this indexing may not be able to get access to classes to index,
75
+ or may unnecessarily slow down startup.
76
+
77
+ Running Hibernate Search within Quarkus or Wildfly has its benefits as:
78
+
79
+ * With the <<compatibility-framework-quarkus,Quarkus>> framework,
80
+ scanning part of the Hibernate Search's startup is executed at build time and the indexes are provided to it automatically.
81
+ * With the <<compatibility-framework-wildfly,WildFly>> application server,
82
+ this part of Hibernate Search's startup is executed in an optimized way and the indexes are provided to it automatically as well.
83
+
84
+ In other cases, depending on the application needs, the https://smallrye.io/jandex/jandex/{jandexPluginVersion}/maven/basic.html[Jandex] Maven Plugin
85
+ can be used during the building stage of the application, so that indexes are already built and ready when the application starts.
86
+
87
+ Alternatively, If your application does not use `@ProjectionConstructor` or <<mapping-custom-annotations-root,custom root mapping annotations>>,
88
+ you may want to disable this feature entirely or partially.
89
+
90
+ **This is not recommended in general as it may lead to bootstrap failures or ignored mapping annotations**
85
91
because Hibernate Search will no longer be able to automatically discover types annotated with
86
92
<<mapping-classpath-scanning-basics,root annotations>>
87
93
in JARs that do not have an embedded Jandex index.
88
94
95
+ Two options are available for this:
96
+
97
+ * Setting `hibernate.search.mapping.discover_annotated_types_from_root_mapping_annotations` to `false`
98
+ will disable any attempts of automatic discovery, even if there is a Jandex index available, partial or full,
99
+ which may help if there are no types annotated with root mapping annotations at all,
100
+ or if they are listed explicitly through a <<mapping-configurer,mapping configurer>>
101
+ or through an <<mapper-pojo-standalone-startup,`AnnotatedTypeSource`>>.
102
+ * Setting `hibernate.search.mapping.build_missing_discovered_jandex_indexes` to `false`
103
+ will disable Jandex index building on startup, but will still use any pre-built Jandex indexes available.
104
+ This may help if partial automatic discovery is required, i.e. available indexes will be used for discovery,
105
+ but sources that do not have an index available will be ignored unless their `@ProjectionConstructor`-annotated types
106
+ are listed explicitly through a <<mapping-configurer,mapping configurer>>
107
+ or through an <<mapper-pojo-standalone-startup,`AnnotatedTypeSource`>>.
108
+
89
109
[[mapping-programmatic]]
90
110
== [[mapper-orm-programmatic-mapping]] [[mapper-orm-programmatic-mapping-basics]] [[hsearch-mapping-programmaticapi]] Programmatic mapping
91
111
0 commit comments