Search code examples
geospatialhibernate-searchspatial-indexhibernate-search-6

How do i configure Spatial mode in Hibernate search 6?


I'm in the process of migrating from hibernate search 5 to 6. Many annotation classes that were present in hibernate search 5 have been completely removed in hibernate 6. One of these annotations was @Spatial. With this annotation you could configure which SpatialMode hibernate search should use when processing spatial information. For instance SpatialMode.HASH.

Now that @Spatial is gone, what is the proper way to set the spatial mode in hibernate 6? I've already checked the documentation but it doesn't mention anything about spatial modes.

EDIT: I believe these are all the settings hibernate search has.

EDIT 2: I did find this property hibernate.search.backend.sharding.strategy that can be set to hash. Is this the property that i need to set?


Solution

  • There is a migration guide from Hibernate Search 5 to Hibernate Search 6

    In this guide, there is a section about @Spatial

    And in this section, there is a subsection about @Spatial.spatialMode:

    @Spatial.spatialMode, @Spatial.topSpatialHashLevel, @Spatial.bottomSpatialHashLevel have no equivalent in Hibernate Search 6: geohash-based geo-point fields are no longer supported.

    For Lucene, this is because Hibernate Search now uses Lucene’s built-in spatial support, which is range-based. For Elasticsearch, hash-based geo-point fields have never been available in the first place.