You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<1> We won't use SSL, so we disable it to have a more compact native executable.
571
-
<2> We need to tell Hibernate Search about the structure of our entities.
568
+
<1> We need to tell Hibernate Search about the structure of our entities.
572
569
+
573
570
In this application we consider an indexed entity (the author) is the root of a "document":
574
571
the author "owns" books it references through associations,
575
572
which *cannot* be updated independently of the author.
576
573
+
577
574
See <<quarkus-hibernate-search-standalone-elasticsearch_quarkus-hibernate-search-standalone-mapping-structure,`quarkus.hibernate-search-standalone.mapping.structure`>> for other options and more details.
578
-
<3> We need to tell Hibernate Search about the version of Elasticsearch we will use.
575
+
<2> We need to tell Hibernate Search about the version of Elasticsearch we will use.
579
576
+
580
577
It is important because there are significant differences between Elasticsearch mapping syntax depending on the version.
581
578
Since the mapping is created at build time to reduce startup time, Hibernate Search cannot connect to the cluster to automatically detect the version.
582
579
Note that, for OpenSearch, you need to prefix the version with `opensearch:`; see <<opensearch>>.
583
-
<4> This means that we wait for the entities to be searchable before considering a write complete.
580
+
<3> This means that we wait for the entities to be searchable before considering a write complete.
584
581
On a production setup, the `write-sync` default will provide better performance.
585
582
Using `sync` is especially important when testing as you need the entities to be searchable immediately.
586
-
<5> For development and tests, we rely on <<dev-services,Dev Services>>,
583
+
<4> For development and tests, we rely on <<dev-services,Dev Services>>,
587
584
which means Quarkus will start an Elasticsearch cluster automatically.
588
585
In production mode, however,
589
586
we will want to start an Elasticsearch cluster manually,
Copy file name to clipboardExpand all lines: _guides/qute-reference.adoc
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2994,10 +2994,9 @@ If there is a message bundle method that accepts a single parameter of an enum t
2994
2994
@Message <1>
2995
2995
String methodName(MyEnum enum);
2996
2996
----
2997
-
<1> The value is intentionally not provided. There's also no key for the method in a localized file.
2998
-
2999
-
Then it receives a generated template:
2997
+
<1> The value is intentionally not provided. There's also no key/value pair for this method in a localized file.
3000
2998
2999
+
Then it receives a generated template like:
3001
3000
[source,html]
3002
3001
----
3003
3002
{#when enumParamName}
@@ -3006,15 +3005,27 @@ Then it receives a generated template:
3006
3005
{/when}
3007
3006
----
3008
3007
3009
-
Furthermore, a special message method is generated for each enum constant. Finally, each localized file must contain keys and values for all constant message keys:
3008
+
Furthermore, a special message method is generated for each enum constant.
3009
+
Finally, each localized file must contain keys and values for all enum constants:
3010
3010
3011
3011
[source,poperties]
3012
3012
----
3013
3013
methodName_CONSTANT1=Value 1
3014
3014
methodName_CONSTANT2=Value 2
3015
3015
----
3016
3016
3017
-
In a template, an enum constant can be localized with a message bundle method like `{msg:methodName(enumConstant)}`.
3017
+
// We need to escape the first underscore
3018
+
// See https://docs.asciidoctor.org/asciidoc/latest/subs/prevent/
3019
+
[IMPORTANT]
3020
+
.Message keys for enum constants
3021
+
====
3022
+
By default, the message key consists of the method name followed by the `\_` separator and the constant name.
3023
+
If any constant name of a particular enum contains the `_` or the `$` character then the `\_$` separator must be used for all message keys for this enum instead.
3024
+
For example, `methodName_$CONSTANT_1=Value 1` or `methodName_$CONSTANT$1=Value 1`.
3025
+
A constant of a localized enum may not contain the `_$` separator.
3026
+
====
3027
+
3028
+
In a template, the localized message for an enum constant can be obtained with a message bundle method like `{msg:methodName(enumConstant)}`.
3018
3029
3019
3030
TIP: There is also <<convenient-annotation-for-enums,`@TemplateEnum`>> - a convenient annotation to access enum constants in a template.
0 commit comments