Associated entities each have their own Lucene index, and also store some data in each other's indexes. With embedded objects, search information is stored exclusively in the containing entity's index.
However, bear in mind that these classes may be associated or embedded in more than one place. For example, if you had the
Publisher entities in your data model, both of them might have an embedded object of type
Normally, we use the
@Field annotation to tell Hibernate Search which fields should be indexed and searchable. However, what if we want this to vary with associated or embedded objects? What if we want a field to be indexed, or not indexed, depending on which other entity contains it? Hibernate Search ...