Skip to content

Commit c92216e

Browse files
committed
HSEARCH-5300 Rename package/processor and clean up the docs
1 parent cf208c6 commit c92216e

File tree

121 files changed

+402
-744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+402
-744
lines changed

Jenkinsfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ stage('Non-default environments') {
498498
// we'd better recompile everything with the same compiler rather than get some strange errors
499499
mavenNonDefaultBuild buildEnv, """ \
500500
-DskipTests -DskipITs \
501-
-P${buildEnv.mavenProfile},!javaModuleITs,!metamodelITs -pl '!:hibernate-search-documentation,!:hibernate-search-reports' \
501+
-P${buildEnv.mavenProfile},!javaModuleITs,!metamodelITs -pl '!:hibernate-search-documentation,!:hibernate-search-documentation-lucene-next,!:hibernate-search-reports' \
502502
-Dgib.buildAll=true \
503503
"""
504504
}

bom/public/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
</dependency>
9595
<dependency>
9696
<groupId>org.hibernate.search</groupId>
97-
<artifactId>hibernate-search-metamodel-processor</artifactId>
97+
<artifactId>hibernate-search-processor</artifactId>
9898
<version>${project.version}</version>
9999
</dependency>
100100
<!-- Relocation artifacts: -->

build/jqassistant/rules/rules.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@
281281
WHEN 'hibernate-search-mapper-orm' THEN 'HibernateOrm'
282282
WHEN 'hibernate-search-mapper-orm-outbox-polling' THEN 'OutboxPolling'
283283
WHEN 'hibernate-search-mapper-orm-jakarta-batch-jberet' THEN 'JBeret'
284-
WHEN 'hibernate-search-metamodel-processor' THEN 'Processor'
284+
WHEN 'hibernate-search-processor' THEN 'Processor'
285285
ELSE 'UNKNOWN-MODULE-SPECIFIC-KEYWORD-PLEASE-UPDATE-JQASSISTANT-RULES'
286286
END
287287
RETURN

build/parents/build/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371
</dependency>
372372
<dependency>
373373
<groupId>org.hibernate.search</groupId>
374-
<artifactId>hibernate-search-metamodel-processor</artifactId>
374+
<artifactId>hibernate-search-processor</artifactId>
375375
<version>${project.version}</version>
376376
</dependency>
377377

build/reports/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</dependency>
7777
<dependency>
7878
<groupId>org.hibernate.search</groupId>
79-
<artifactId>hibernate-search-metamodel-processor</artifactId>
79+
<artifactId>hibernate-search-processor</artifactId>
8080
</dependency>
8181
<dependency>
8282
<groupId>org.hibernate.search</groupId>

documentation/pom.xml

+36-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</dependency>
6565
<dependency>
6666
<groupId>${project.groupId}</groupId>
67-
<artifactId>hibernate-search-metamodel-processor</artifactId>
67+
<artifactId>hibernate-search-processor</artifactId>
6868
<scope>test</scope>
6969
</dependency>
7070
<dependency>
@@ -121,7 +121,42 @@
121121
even though we don't explicitly use it.
122122
This is probably a compiler bug, so here we need to work around it. -->
123123
<showDeprecation>false</showDeprecation>
124+
<testExcludes>
125+
<exclude>org/hibernate/search/documentation/search/metamodel/**</exclude>
126+
</testExcludes>
124127
</configuration>
128+
<executions>
129+
<execution>
130+
<id>generate-metamodel</id>
131+
<phase>test-compile</phase>
132+
<goals>
133+
<goal>testCompile</goal>
134+
</goals>
135+
<configuration>
136+
<proc>full</proc>
137+
<testIncludes>
138+
<include>org/hibernate/search/documentation/search/metamodel/**</include>
139+
</testIncludes>
140+
<testExcludes combine.self="override" combine.children="override"></testExcludes>
141+
<showWarnings>false</showWarnings>
142+
<annotationProcessors>
143+
<annotationProcessor>org.hibernate.search.processor.HibernateSearchProcessor</annotationProcessor>
144+
</annotationProcessors>
145+
<annotationProcessorPaths>
146+
<path>
147+
<groupId>org.hibernate.search</groupId>
148+
<artifactId>hibernate-search-processor</artifactId>
149+
<version>${project.version}</version>
150+
</path>
151+
<path>
152+
<groupId>org.hibernate.search</groupId>
153+
<artifactId>hibernate-search-backend-elasticsearch</artifactId>
154+
<version>${project.version}</version>
155+
</path>
156+
</annotationProcessorPaths>
157+
</configuration>
158+
</execution>
159+
</executions>
125160
</plugin>
126161
<plugin>
127162
<groupId>org.apache.maven.plugins</groupId>

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ is it searchable, sortable, projectable,
5050
what is the expected java class for arguments to the <<search-dsl,Search DSL>>,
5151
what are the analyzers/normalizer set on this field,
5252
...
53-
<9> Inspect the "traits" of a field type:
54-
each trait represents a predicate/sort/projection/aggregation
55-
that can be used on fields of that type.
53+
<9> Inspect the <<mapping-inspect-traits,"traits">> of a field type.
5654
<10> Object fields can also be inspected.
5755
<11> A collection of all configured analyzers
5856
available for the index represented by the descriptor can also be inspected.
@@ -64,6 +62,14 @@ available for the index represented by the descriptor can also be inspected.
6462
to see if a particular normalizer is available within the index context.
6563
====
6664

65+
[[mapping-inspect-traits]]
66+
[TIP]
67+
====
68+
Traits define the set of search capabilities available for the field,
69+
in particular, each trait represents a predicate/sort/projection/aggregation
70+
that can be used on that field.
71+
====
72+
6773
[TIP]
6874
====
6975
The `Backend` and `IndexManager` can also be used to

documentation/src/main/asciidoc/public/reference/_static-metamodel-overview.adoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
include::../components/_incubating-warning.adoc[]
77

88
The static metamodel class describes the index structure. Each indexed entity (index) is represented by a single class
9-
that may contain inner classes describing the embeddables (i.e. nested/flattened objects). These classes contain <<static-metamodel-processor-field-reference-types,field references>>
9+
that may contain inner classes describing object fields (e.g. from <<mapping-indexedembedded,indexed-embedded properties>>). These classes contain <<static-metamodel-processor-field-reference-types,field references>>
1010
representing index fields and their search capabilities.
1111

1212
The name of this root class is constructed from the indexed entity name by adding `pass:[__]` (two underscores) suffix, e.g. `MySearchEntitypass:[__]`.
1313
If the indexed entity is a (static) inner class, then all the owning classes will be part of the name delimited with a `pass:[_]` (single underscore),
1414
e.g. `MyOuterClasspass:[_]MySearchEntitypass:[__]`.
1515
These classes are created in the same package where the search entity they represent is located.
1616

17-
The root metamodel class that describes the indexed entity has a static field `INDEX` that users can use to interact with the metamodel.
17+
The root metamodel class that describes the indexed entity has a static field `INDEX` that you can use to interact with the metamodel.
1818
It serves two primary purposes:
1919

2020
* It simplifies creating the search scope and building search queries for such scope.
@@ -39,15 +39,15 @@ limit acceptable field references to the ones obtained from the `Book__.INDEX`
3939

4040
A field reference type describes the set of search capabilities a particular index field has, in particular,
4141
what kind of projections/aggregations/predicates/sorts are allowed, if any. It does so by implementing a
42-
subset of search traits interfaces defined in `org.hibernate.search.engine.search.reference.pass:[*]`, which in turn allows
42+
subset of <<mapping-inspect-traits,search "trait">> interfaces defined in `org.hibernate.search.engine.search.reference.pass:[*]`, which in turn allows
4343
performing compile-time checks when building <<search-dsl,search queries>>.
4444

4545
====
4646
[source, JAVA, indent=0, subs="+callouts"]
4747
----
4848
include::{sourcedir}/org/hibernate/search/documentation/search/metamodel/MetamodelIT.java[tags=compileCheck-pass]
4949
----
50-
<1> If the title field is projectable then this compiles works fine,
50+
<1> If the title field is projectable then this compiles fine,
5151
otherwise compilation fails with an error similar to:
5252
+
5353
----
@@ -64,5 +64,5 @@ The field reference also provides a way to quickly switch between <<search-dsl-a
6464
----
6565
include::{sourcedir}/org/hibernate/search/documentation/search/metamodel/MetamodelIT.java[tags=valueModel]
6666
----
67-
<1> Calling `string()` on a field reference is an eqivalent to `.field( "genre" ).matching( <search value>, ValueModel.STRING )`
67+
<1> Calling `string()` on a field reference is an equivalent to `.field( "genre" ).matching( <search value>, ValueModel.STRING )`
6868
====

documentation/src/main/asciidoc/public/reference/_static-metamodel-processor.adoc

+20-14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include::../components/_incubating-warning.adoc[]
99
== Enabling the annotation processor
1010

1111
Hibernate Search provides a dedicated annotation processor to generate the static metamodel classes.
12-
This annotation processor is located in the `org.hibernate.search:hibernate-search-metamodel-processor`.
12+
This annotation processor is located in the `org.hibernate.search:hibernate-search-processor`.
1313

1414
The annotation processor has to be added to the build, e.g. for Maven:
1515

@@ -23,12 +23,12 @@ The annotation processor has to be added to the build, e.g. for Maven:
2323
<id>default-compile</id>
2424
<configuration>
2525
<annotationProcessors>
26-
<annotationProcessor>org.hibernate.search.metamodel.processor.HibernateSearchMetamodelProcessor</annotationProcessor> <1>
26+
<annotationProcessor>org.hibernate.search.processor.HibernateSearchProcessor</annotationProcessor> <1>
2727
</annotationProcessors>
2828
<annotationProcessorPaths>
2929
<path>
3030
<groupId>org.hibernate.search</groupId>
31-
<artifactId>hibernate-search-metamodel-processor</artifactId> <2>
31+
<artifactId>hibernate-search-processor</artifactId> <2>
3232
</path>
3333
<path>
3434
<groupId>org.hibernate.search</groupId>
@@ -42,12 +42,13 @@ The annotation processor has to be added to the build, e.g. for Maven:
4242
----
4343
4444
<1> Provide the fully qualified class name of the annotation processor that generates the metamodel.
45-
<2> Add the `org.hibernate.search:hibernate-search-metamodel-processor` dependency as an annotation processor path for the Maven compiler plugin to be able to actually find the processor.
46-
<3> Add the backend dependency, in this example, the <<backend-lucene,Lucene backend>>, as an annotation processor path.
45+
<2> Add the `org.hibernate.search:hibernate-search-processor` dependency to the annotation processor path (a superset of the compile path), so the Java compiler can find the processor.
46+
<3> Add the backend dependency, in this example, the <<backend-lucene,Lucene backend>>, to the annotation processor path.
4747
It is important to include the same backend that the application is using to make sure that the generated metamodel classes reflect all the backend specifics.
48-
For example, backends might have different defaults, resulting in a different set of field traits depending on the backend.
48+
For example, backends might have different defaults, resulting in a different set of <<mapping-inspect-traits,search traits>> per specific field, depending on the backend.
4949
50-
NOTE: The version of both annotation processor and backend dependencies are skipped in the definition of the annotation paths, as in case the Hibernate Search BOM is imported via dependency management, the compiler plugin will use the managed versions.
50+
NOTE: The version of both annotation processor and backend dependencies can be ommitted in the definition of the annotation paths,
51+
because they are defined in the Hibernate Search BOM, which we recommend you import via dependency management.
5152
This way the generated metamodel classes will be based on the same backend that the application uses.
5253
====
5354

@@ -66,7 +67,7 @@ The annotation processor options are passed as the compiler arguments with the `
6667
<id>default-compile</id>
6768
<configuration>
6869
<compilerArgs>
69-
<arg>-Aorg.hibernate.search.metamodel.processor.generated_annotation.timestamp=false</arg> <1>
70+
<arg>-Aorg.hibernate.search.processor.generated_annotation.timestamp=false</arg> <1>
7071
<arg><!-- ... --></arg> <2>
7172
</compilerArgs>
7273
<!-- ... --> <3>
@@ -83,34 +84,39 @@ The annotation processor options are passed as the compiler arguments with the `
8384

8485
The following annotation processor configuration properties are available:
8586

86-
[[static-metamodel-processor-configuration-generated_annotation-add]]`org.hibernate.search.metamodel.processor.generated_annotation.add`::
87+
[[static-metamodel-processor-configuration-generated_annotation-add]]`org.hibernate.search.processor.generated_annotation.add`::
8788
Description:::
8889
Whether to add the `@Generated` annotation to the generated static metamodel classes.
8990
Default value:::
9091
`true`
9192

92-
[[static-metamodel-processor-configuration-generated_annotation-timestamp]]`org.hibernate.search.metamodel.processor.generated_annotation.timestamp`::
93+
[[static-metamodel-processor-configuration-generated_annotation-timestamp]]`org.hibernate.search.processor.generated_annotation.timestamp`::
9394
Description:::
9495
Defines whether the `@Generated` annotation includes the `date` attribute.
9596
Having the date attribute will result in non-reproducible builds, as the timestamp will be different for each compilation.
9697
Hence, it is disabled by default.
9798
Default value:::
9899
`false`
99100

100-
[[static-metamodel-processor-configuration-add_generated_annotation]]`org.hibernate.search.metamodel.processor.backend.version`::
101+
[[static-metamodel-processor-configuration-add_generated_annotation]]`org.hibernate.search.processor.backend.version`::
101102
Description:::
102103
Explicitly define the backend version. By default, the processor will use the latest compatible version of the backend.
103104
This option can be used if the static metamodel is required for an older backend version.
105+
While this option is mostly for the Elasticsearch backend,
106+
where it translates into <<configuration-properties-aggregated-hibernate-search-backend-elasticsearchhibernate.search.backend.version,`hibernate.search.backend.version`>>,
107+
it will also translate into <<configuration-properties-aggregated-hibernate-search-backend-lucenehibernate.search.backend.lucene_version,`hibernate.search.backend.lucene_version`>> if the Lucene backend is used.
104108
Default value:::
105109
`<latest>`
106110

107111
[[static-metamodel-processor-limitations]]
108112
== Current annotation processor limitations
109113

110-
While the annotation processor is in its early stages of development, it has a few limitations:
114+
While the annotation processor is very much functional and we encourage you to try it,
115+
it is still in the early stages of development, and thus has a few limitations:
111116

112117
* Any use of <<binding-valuebridge-valuebinder,custom binders>> will be ignored and should produce a compiler warning.
113118
This means that if the search entities rely on custom binders, fields that those binders produce will be missing from the generated metamodel.
114-
* <<mapper-orm-custom-annotations,Custom mapping annotations>> are not supported.
119+
* <<mapper-orm-custom-annotations,Custom mapping annotations>> are ignored without warning.
115120
* <<mapping-programmatic,Programmatic mapping>> is also unsupported by the annotation processor.
116-
As the annotation processor cannot easily read programmatic mapping definitions, this limitation is here to stay.
121+
As the annotation processor cannot possibly execute programmatic mapping defined in the code that is being compiled,
122+
this limitation is here to stay.

documentation/src/main/asciidoc/public/reference/_static-metamodel.adoc

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55

66
include::../components/_incubating-warning.adoc[]
77

8-
Hibernate Search static metamodel represents the index structure
9-
that provides a type-safe way of creating search queries through the <<search-dsl,Search DSL>>.
8+
Hibernate Search's static metamodel is a set of generated classes that represents the structure of each entity's index,
9+
thereby allowing to reference index fields in a type-safe way to create search queries through the <<search-dsl,Search DSL>>.
10+
11+
The basic principles are very similar to the link:{hibernateDocUrl}#tooling-modelgen[JPA static metamodel available in Hibernate ORM],
12+
but in the case of Search the metamodel is about indexes rather than entities.
1013

1114
:leveloffset: +1
1215

documentation/src/test/java/org/hibernate/search/documentation/search/converter/ProjectionConverterIT.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public void setStatus(OrderStatus status) {
165165
}
166166
}
167167

168-
private enum OrderStatus {
168+
enum OrderStatus {
169169
ACKNOWLEDGED,
170170
IN_PROGRESS,
171171
DELIVERED

documentation/src/test/java/org/hibernate/search/documentation/search/metamodel/Author.java

-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ public class Author {
3030
@ManyToMany(mappedBy = "authors")
3131
private List<Book> books = new ArrayList<>();
3232

33-
public Author() {
34-
}
35-
3633
public Integer getId() {
3734
return id;
3835
}

0 commit comments

Comments
 (0)