Last night we released Hibernate Search 5.2.0.Beta1, and as many users requested we worked on Multi-Tenancy support.
This feature was available since some time in Hibernate ORM, but while Hibernate Search would not prevent you to use it, it wouldn't apply the same strict isolation on full-text queries. This is all implemented now, and is super easy to use.
It's not different than any usage of Hibernate ORM's multi-tenancy. After you open a tenant-aware 'Session', changes will be tagged as belonging to a specific tenant automatically.
When performing a full-text query, you'll only get results from the current tenant.
When rebuilding the index using the MassIndexer, it will rebuild only the index from the current tenant. When performing a
purgeAll operation, it will only delete entries which belong to the current tenant.
In this implementation, as suggested by some of you we didn't create a fully independent index for each tenant, but each Document in the index gets
tagged by the tenantid.
I am wondering if we should also implement a variation in which we keep each tenant's data into a fully independent index: please let us know what you think about that. The current approach of a single index works better if you have a very high amount of tenants, as there are practical limits in how many indexes can be managed. Another benefit of the current approach, is that you can easily plug in a clever custom sharding implementation; by working on a modulo approach among a list of tenants, you can tune it for a reasonable level of separation without necessarily having as many indexes as tenants.
The performance improvement highlight of the month goes to a revisited strategy on our internal usage of criterias when loading polymorphic results. If you were loading full-text results from a non-trivial class hierarchy you might notice a sweet performance improvement. For more details see HSEARCH-1793.
The async variation of the MassIndexer returns a Future, but this didn't implement the cancel operation. Many thanks to Yoann Gendre for implementing it!
For the list of minor improvements, please refer to the changelog.