Skip to content

Commit 8e7ada6

Browse files
committed
HSEARCH-5018 Update docs
1 parent 093ea19 commit 8e7ada6

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

documentation/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@
305305
<javaeeUrl>https://www.oracle.com/java/technologies/java-ee-glance.html</javaeeUrl>
306306
<jakartaUrl>https://jakarta.ee/</jakartaUrl>
307307
<jakartaPersistenceVersion>${parsed-version.jakarta.persistence.majorVersion}.${parsed-version.jakarta.persistence.minorVersion}</jakartaPersistenceVersion>
308+
<jandexPluginVersion>${version.jandex.plugin}</jandexPluginVersion>
308309
<luceneVersion>${version.org.apache.lucene}</luceneVersion>
309310
<luceneUrl>https://lucene.apache.org</luceneUrl>
310311
<luceneJavadocUrl>${javadoc.org.apache.lucene.core.url}</luceneJavadocUrl>

documentation/src/main/asciidoc/public/reference/_mapping-configuration.adoc

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,45 @@ to look for types annotated with
6767
<<mapping-classpath-scanning-basics,root mapping annotations>> in the given Jandex index.
6868

6969
[[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**
8591
because Hibernate Search will no longer be able to automatically discover types annotated with
8692
<<mapping-classpath-scanning-basics,root annotations>>
8793
in JARs that do not have an embedded Jandex index.
8894

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+
89109
[[mapping-programmatic]]
90110
== [[mapper-orm-programmatic-mapping]] [[mapper-orm-programmatic-mapping-basics]] [[hsearch-mapping-programmaticapi]] Programmatic mapping
91111

0 commit comments

Comments
 (0)