This is only presented here so that you know the option is available. There is really not much benefit in sharing indexes.
It is technically possible to store the information of more than one entity into a single Lucene index. There are two ways to accomplish this:
Configuring the underlying directory providers to point to the
same physical index directory. In practice, you set the property
hibernate.search.[fully qualified entity
name].indexName to the same value. As an example let’s use
the same index (directory) for the Furniture
and Animal entity. We just set
indexName for both entities to for example
“Animal”. Both entities will then be stored in the Animal
directory
hibernate.search.org.hibernate.search.test.shards.Furniture.indexName = Animal
hibernate.search.org.hibernate.search.test.shards.Animal.indexName = AnimalSetting the @Indexed annotation’s
index attribute of the entities you want to
merge to the same value. If we again wanted all
Furniture instances to be indexed in the
Animal index along with all instances of
Animal we would specify
@Indexed(index=”Animal”) on both
Animal and Furniture
classes.