FullTextSessionBuilder builder = new FullTextSessionBuilder()
.addAnnotatedClass( Catalog.class )
.addAnnotatedClass( CatalogItem.class )
.addAnnotatedClass( Consumer.class )
.addAnnotatedClass( Item.class );
SearchMapping fluentMapping = builder.fluentMapping();
// mapping for Catalog
EntityMapping catalogMapping = fluentMapping
.entity( Catalog.class );
if ( withClassBridgeOnCatalog ) {
catalogMapping.classBridge( NoopClassBridge.class );
}
catalogMapping
.property( "catalogItems", ElementType.FIELD ).containedIn();
// mapping for CatalogItem
fluentMapping.entity( CatalogItem.class )
.property( "item", ElementType.FIELD ).containedIn()
.property( "catalog", ElementType.FIELD ).indexEmbedded();
// mapping for Item
IndexedMapping itemMapping = fluentMapping
.entity( Item.class )
.indexed();
if ( withClassBridgeOnItem ) {
itemMapping.classBridge( NoopClassBridge.class );
}