grails-hibernate-search-plugin icon indicating copy to clipboard operation
grails-hibernate-search-plugin copied to clipboard

upgrade to handle grails 5 and hibernate 5.5

Open olliefreeman opened this issue 3 years ago • 10 comments

Grails 5 will release with a dependency on hibernate 5.5 which hibernate search does not support at the current version. https://hibernate.org/search/releases.

We therefore need to update to hibernate search 6

olliefreeman avatar Oct 11 '21 13:10 olliefreeman

I have started work on this locally as it requires updating to hibernate search 6 and lucene 8. Has anyone else started work on this??

olliefreeman avatar Oct 11 '21 13:10 olliefreeman

Not on my side, sorry

lgrignon avatar Oct 11 '21 13:10 lgrignon

for anyone interested the work is here https://github.com/olliefreeman/grails-hibernate-search-plugin/tree/feature/update-to-hibernate-search-6

I will submit PR once its ready, i will be testing this against our main project which uses most of the existing features.

Any requests for missing features please add information here and i will endeavour to add them

olliefreeman avatar Oct 11 '21 15:10 olliefreeman

The readme and grails page will need some decent updating as per https://docs.jboss.org/hibernate/search/6.0/migration/html_singl to help people migrate

olliefreeman avatar Oct 11 '21 15:10 olliefreeman

I'm hoping i can backstep grails and hibernate core to work with grails 4, but that depends

olliefreeman avatar Oct 11 '21 15:10 olliefreeman

backstepping will work for grails 4 however at this point we need https://hibernate.atlassian.net/browse/HSEARCH-4348 to be accepted and released to allow binding with traits

olliefreeman avatar Oct 18 '21 11:10 olliefreeman

my branch is now migrated apart from the documentation. There are a few features which are not compatible at all however I have tried to accomadate as much as possible. The documentation will provide all this informaiton

olliefreeman avatar Nov 01 '21 16:11 olliefreeman

Hi @olliefreeman It seems like your branch is the only effort to get this plugin upgraded to be compatible with Grails 5 (?). Just checking if you submitted a PR? And has your branch (ver 3.0.0?) been published and available on a Maven repo to use? I don't see it in https://repo.grails.org/ui/native/core/org/grails/plugins/hibernate-search and https://grails.jfrog.io/ui/native/core/org/grails/plugins/hibernate-search

mtgleeson avatar Dec 27 '21 03:12 mtgleeson

Hi @olliefreeman First off, thanks for the effort you've put in to upgrade the plugin to make it Grails 5 and Hibernate Search 6 compatible. I forked your branch to make a few changes, see below. Let me know if you want me to create a pull-request. It will be great if we can publish an official 3.0.0 version of the plugin to the grails maven repo for others to use. https://github.com/mtgleeson/grails-hibernate-search-plugin/tree/feature/update-to-hibernate-search-6

  • update hibernate plugin to use hibernate5:7.2.0
  • update hibernate to use 5.6.3.Final
  • update hibernate search mapper orm to use 6.1.0.Beta1 (this version contains a fix for the bug you raised so there's no need to use 6.0.8.OXBRC anymore) https://hibernate.atlassian.net/browse/HSEARCH-4348.
  • configure the search mapper configurer to instantiate a new GrailsHibernateSearchMappingConfigurer instead of looking for a bean (I was getting an error on start-up saying it couldn't find the hibernateSearchMappingConfigurer bean).
  • allow the id field in domain classes to be configured in the search closure.
  • change the id field type away from the keyword field to use a generic field. Id fields are longs which are not compatible with keyword fields.
  • allow domain properties of type BigDecimal and BigInteger to use the ScaledNumberField type with a specified decimal scale instead of using generic field type.
  • fix a bug to allow projections on multi-valued fields for full text queries.
  • I updated the README.md with the above details.

A couple of other notes:

  • I noticed the default directory set in hibernate.search.backend.directory.root (GrailsHibernateSearchMappingConfigurer.configure) was not being picked up as a property in Hibernate Search and it was using its own default path ("."). I didn't get a chance to look into why this wasn't working although I noticed you changed how this was being set to use grailsApplication.config.setAt in a recent commit.
  • I tried defining a normalizer in runtime.groovy as per the README.md but it wasn't being created. I didn't spend much time looking into why but I was able to create a normalizer by implementing LuceneAnalysisConfigurer and configuring hibernate.search.backend.analysis.configurer = 'class:com.example.lucene.MyLuceneAnalysisConfigurer' I added a note to the README.md for this.

mtgleeson avatar Jan 03 '22 08:01 mtgleeson

@mtgleeson massive apologies for the complete lack of response, but work's been hectic and we;ve been using the system without need to update it much. I am now in the process of actually getting the readme updated and will take into account everything you've mentioned here, and make updates appropriately

As a precursor...this particular branch is designed for grails 4, however we are using it in grails 5. My plan was to release this for grails 4 and then put another release in with the updated dependencies for grails5...but time fell away. Also technically this current version should use the latest 6.0.x version (which yes has the fix required) rather than 6.1.0.

olliefreeman avatar May 17 '22 14:05 olliefreeman