KyelJmD
KyelJmD

Reputation: 4732

Hibernate Search Indexing a single tenant

The database I am working on has a multi-tenant design. I want to implement hibernate search on my application however I want hibernate search to index a certain tenant only. How do I achieve that?

Upvotes: 3

Views: 429

Answers (1)

Hardy
Hardy

Reputation: 19129

You should be able to use dynamic sharding - http://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#advanced-features-dynamic-sharding

This allows you to split (shard) the data into several Lucene indexes. Using dynamic sharding you can route the data at index and query time using a custom ShardIdentifierProvider. This requires of course that in the implementation you have access to the tenant id, for example via a ThreadLocal.

Upvotes: 3

Related Questions