Indexing Inheritance Hierarchy

The docs are not great on this. I have a Content base class then different types, strategy is JOINED. So should not make base class @Indexed but can annotate fields. Fine. But then I end up with different indexes for every subtype? Total nonstarter?

The indexes are per type but you can target the base class for searches. The fact that the indexes are separate is just an implementation detail from the user point of view.

Typically, if you have Associate extending Person and Manager extending Person, you can target Person for your search and it will return both Person and Manager instances matching the query.

Ok great, is there a sample? or a part of the docs you could point me to? I have been through the docs I thought.

The documentation about how to query multiple entity types is here: Hibernate Search 6.1.7.Final: Reference Documentation .

As you can see it’s transparent for you.

Ok, yeah I got that to compile, but still have issues with my test per my other ticket the mass indexer is not seeing entities to index, even though findAll sees them there. Was hoping this would be more turnkey.

Apparently solved, quoting:

One of the sites I work on has this. We’ve been seeing CPU Bottlenecks due to some very long queries. We didn’t get crazy with subclassing, but it did get crazy with the number of foreignkeys and many to many’s on the subclass which seems to be causing an excessive amount of queries. I don’t have much experience with the other way you defined, at scale, so I can’t really say if its worse or not.