|
| 1 | += Hibernate Search 8.0.0.Beta1 is out |
| 2 | +Marko Bekhta |
| 3 | +:awestruct-tags: [ "Hibernate Search", "Lucene", "Elasticsearch", "Releases" ] |
| 4 | +:awestruct-layout: blog-post |
| 5 | +:hsearch-doc-url-prefix: https://docs.jboss.org/hibernate/search/8.0/reference/en-US/html_single/ |
| 6 | +:horm-doc-url-prefix: https://docs.jboss.org/hibernate/orm/7.0/userguide/html_single/Hibernate_User_Guide.html |
| 7 | +:hsearch-getting-started-orm-url-prefix: https://docs.jboss.org/hibernate/search/8.0/getting-started/orm/en-US/html_single/ |
| 8 | +:hsearch-getting-started-standalone-url-prefix: https://docs.jboss.org/hibernate/search/8.0/getting-started/standalone/en-US/html_single/ |
| 9 | +:hsearch-jira-url-prefix: https://hibernate.atlassian.net/browse |
| 10 | +:hsearch-version-family: 8.0 |
| 11 | +:hsearch-jira-project-id: 10061 |
| 12 | +:hsearch-jira-version-id: 33109 |
| 13 | +--- |
| 14 | + |
| 15 | +We just published Hibernate Search 8.0.0.Beta1, |
| 16 | +the first beta release of the next major version of Hibernate Search. |
| 17 | + |
| 18 | +This version includes the first implementation of the type-safe field references and Hibernate Search's static metamodel, |
| 19 | +compatibility with the latest versions of Elasticsearch 9.0 and OpenSearch 3.0, |
| 20 | +and other small adjustments and dependency upgrades. |
| 21 | + |
| 22 | +== What's new |
| 23 | + |
| 24 | +[NOTE] |
| 25 | +==== |
| 26 | +Hibernate Search 8.0 is still in its early stages of development: |
| 27 | +some features still need to be completed or may change in a backwards-incompatible way. |
| 28 | +==== |
| 29 | + |
| 30 | +=== Dependency upgrades |
| 31 | + |
| 32 | +[[orm-version]] |
| 33 | +Hibernate ORM (link:{hsearch-jira-url-prefix}/HSEARCH-5367[HSEARCH-5367]):: |
| 34 | +Hibernate Search targets the Hibernate ORM 7.0 series, which implements Jakarta Persistence 3.2.0. |
| 35 | +In particular, it is currently based on Hibernate ORM 7.0.0.CR1. |
| 36 | +[[lucene-version]] |
| 37 | +Lucene (link:{hsearch-jira-url-prefix}/HSEARCH-5373[HSEARCH-5373]):: |
| 38 | +The Lucene-next backend now uses Lucene 10.2.1. |
| 39 | +[[elasticsearch-version]] |
| 40 | +Elasticsearch (link:{hsearch-jira-url-prefix}/HSEARCH-5361[HSEARCH-5361]/(link:{hsearch-jira-url-prefix}/HSEARCH-5365[HSEARCH-5365]:: |
| 41 | +The Elasticsearch backend works with Elasticsearch 9.0 and 8.18, as well as other already compatible versions. |
| 42 | +[[opensearch-version]] |
| 43 | +OpenSearch (link:{hsearch-jira-url-prefix}/HSEARCH-5363[HSEARCH-5363]:: |
| 44 | +The Elasticsearch backend works with OpenSearch 3.0, as well as other already compatible versions. |
| 45 | +[[others-version]] |
| 46 | +Others:: |
| 47 | +* link:{hsearch-jira-url-prefix}/HSEARCH-5374[HSEARCH-5374]: Upgrade to Elasticsearch **client** 9.0.1 |
| 48 | +* link:{hsearch-jira-url-prefix}/HSEARCH-5370[HSEARCH-5370]: Upgrade to GSON 2.13.1.Final |
| 49 | +* link:{hsearch-jira-url-prefix}/HSEARCH-5368[HSEARCH-5368]: Upgrade to Jandex 3.3 |
| 50 | +* link:{hsearch-jira-url-prefix}/HSEARCH-5371[HSEARCH-5371]: Upgrade to Jackson 2.19.0 |
| 51 | + |
| 52 | +[[static-metamodel]] |
| 53 | +=== Static metamodel |
| 54 | + |
| 55 | +Hibernate Search's link:{hsearch-doc-url-prefix}#static-metamodel[static metamodel] is a set of generated classes that represents the structure of each entity's index, |
| 56 | +thereby allowing type-safe references to index fields when creating search queries through the link:{hsearch-doc-url-prefix}#search-dsl[Search DSL]. |
| 57 | + |
| 58 | +The basic principles are very similar to the link:{horm-doc-url-prefix}#tooling-modelgen[JPA static metamodel available in Hibernate ORM], |
| 59 | +but in the case of Search the metamodel is about indexes rather than entities. |
| 60 | + |
| 61 | +To try out this new feature, add the annotation processor to the build configuration: |
| 62 | + |
| 63 | +==== |
| 64 | +[source,XML,subs="+attributes"] |
| 65 | +---- |
| 66 | +<plugin> |
| 67 | + <artifactId>maven-compiler-plugin</artifactId> |
| 68 | + <executions> |
| 69 | + <execution> |
| 70 | + <id>default-compile</id> |
| 71 | + <configuration> |
| 72 | + <annotationProcessors> |
| 73 | + <annotationProcessor>org.hibernate.search.processor.HibernateSearchProcessor</annotationProcessor> <1> |
| 74 | + </annotationProcessors> |
| 75 | + <annotationProcessorPaths> |
| 76 | + <path> |
| 77 | + <groupId>org.hibernate.search</groupId> |
| 78 | + <artifactId>hibernate-search-processor</artifactId> <2> |
| 79 | + </path> |
| 80 | + <path> |
| 81 | + <groupId>org.hibernate.search</groupId> |
| 82 | + <artifactId>hibernate-search-backend-lucene</artifactId> <3> |
| 83 | + </path> |
| 84 | + </annotationProcessorPaths> |
| 85 | + </configuration> |
| 86 | + </execution> |
| 87 | + </executions> |
| 88 | +</plugin> |
| 89 | +---- |
| 90 | +
|
| 91 | +<1> Provide the fully qualified class name of the annotation processor that generates the metamodel. |
| 92 | +<2> Add the `org.hibernate.search:hibernate-search-processor` dependency to the annotation processor path (a superset of the compile path), |
| 93 | +so the Java compiler can find the processor. |
| 94 | +<3> Add the backend dependency, in this example, the Lucene backend, to the annotation processor path. |
| 95 | +
|
| 96 | +NOTE: The version of both annotation processor and backend dependencies can be omitted in the definition of the annotation paths, |
| 97 | +because they are defined in the Hibernate Search BOM, which we recommend you import via dependency management. |
| 98 | +This way the generated metamodel classes will be based on the same backend that the application uses. |
| 99 | +==== |
| 100 | + |
| 101 | +And then use the generated metamodel classes to create search queries, e.g.: |
| 102 | + |
| 103 | +==== |
| 104 | +[source, JAVA, indent=0, subs="+callouts"] |
| 105 | +---- |
| 106 | +SearchSession searchSession = /* ... */; // <1> |
| 107 | +var scope = Book__.INDEX.scope( searchSession ); // <2> |
| 108 | +
|
| 109 | +List<Book> hits = searchSession.search( scope ) |
| 110 | + .where( f -> f.match() |
| 111 | + .field( Book__.INDEX.title ).field( Book__.INDEX.description ) // <3> |
| 112 | + .matching( "robot" ) ) |
| 113 | + .fetchHits( 20 ); |
| 114 | +---- |
| 115 | +<1> Obtain the search session. |
| 116 | +<2> Create the search scope over the book index. Using such scope in the link:{hsearch-doc-url-prefix}#search-dsl[Search DSL] will automatically |
| 117 | +limit acceptable field references to the ones obtained from the `Book__.INDEX` |
| 118 | +<3> Use the metamodel to reference the fields when creating the queries. |
| 119 | +==== |
| 120 | + |
| 121 | +See the corresponding section on link:{hsearch-doc-url-prefix}#static-metamodel[static metamodel] |
| 122 | +to find out more. |
| 123 | + |
| 124 | +[[other-changes]] |
| 125 | +=== Other improvements and bug fixes |
| 126 | + |
| 127 | +* link:{hsearch-jira-url-prefix}/HSEARCH-5305[HSEARCH-5305]: |
| 128 | +Allow vector embeddings up to 16,000 dimensions with the Lucene backends. |
| 129 | +* link:{hsearch-jira-url-prefix}/HSEARCH-5358[HSEARCH-5358]: |
| 130 | +Fail faster if an enclosing instance parameter is encountered in a projection constructor on JDK 25+. |
| 131 | + |
| 132 | +And more. |
| 133 | +Please see the link:https://hibernate.atlassian.net/issues/?jql=project={hsearch-jira-project-id}+AND+fixVersion={hsearch-jira-version-id}[release notes] |
| 134 | +for a complete list of changes since the previous releases. |
| 135 | + |
| 136 | +== How to get this release |
| 137 | + |
| 138 | +All details are available and up to date on the |
| 139 | +link:https://hibernate.org/search/releases/{hsearch-version-family}/#get-it[dedicated page on hibernate.org]. |
| 140 | + |
| 141 | +== Getting started, migrating |
| 142 | + |
| 143 | +For new applications, |
| 144 | +refer to the getting started guide: |
| 145 | + |
| 146 | +* link:{hsearch-getting-started-orm-url-prefix}[here for the Hibernate ORM integration] |
| 147 | +* link:{hsearch-getting-started-standalone-url-prefix}[here for the Standalone POJO Mapper] |
| 148 | + |
| 149 | +For existing applications, Hibernate Search {hsearch-version-family} is a drop-in replacement for 7.1, |
| 150 | +assuming you also upgrade the dependencies. |
| 151 | +Information about deprecated configuration and API |
| 152 | +is included in the https://docs.jboss.org/hibernate/search/{hsearch-version-family}/migration/html_single/[migration guide]. |
| 153 | + |
| 154 | +== Feedback, issues, ideas? |
| 155 | + |
| 156 | +To get in touch, use the following channels: |
| 157 | + |
| 158 | +* http://stackoverflow.com/questions/tagged/hibernate-search[hibernate-search tag on Stackoverflow] (usage questions) |
| 159 | +* https://discourse.hibernate.org/c/hibernate-search[User forum] (usage questions, general feedback) |
| 160 | +* https://hibernate.atlassian.net/browse/HSEARCH[Issue tracker] (bug reports, feature requests) |
| 161 | +* http://lists.jboss.org/pipermail/hibernate-dev/[Mailing list] (development-related discussions) |
0 commit comments