4

Im planning to use Hibernate Search for fulltext search on my models and im concerened whether I can continue to use InheritanceType.SINGLE_TABLE for my model hierachy or whether I have to manually create one big flat model. Basically I have two requieremnts:

  • Being able to perform a search on all submodels of a concrete model in the hierachy
  • Being able to perform a search both on common fields of basemodels and fields of the concrete submodel

Unfortunately the reference doesnt says anything about inheritance but just about embedded and associated objects.

DataNucleus
  • 15,497
  • 3
  • 32
  • 37
Sebastian Hoffmann
  • 11,127
  • 7
  • 49
  • 77

2 Answers2

3

The JPA inheritance model does not play a role for Hibernate Search and as the previous answer indicated it is even the default.

On the other hand the Lucene document is a flat structure, basically a map of field names to valuaes. On top of the fields you are indexing, Hibernate Search adds the unique primary key of the entity and its class name. The latter is used when you limit your search to a certain class(es).

Hardy
  • 18,659
  • 3
  • 49
  • 65
1

No problem because "SINGLE_TABLE" is the default for InheritanceType and support what you indicate.

Regards,

Manu Navarro
  • 700
  • 6
  • 9