HSearch Metamodel

By virtual, i mean field who are indexed in elastic but not really mapped in Hibernate.
I describe one example few month ago here => Hibernate Search 6 - Advanced mapping

this kind of fields are @Transient for hibernate and for the metamodel

List<Book> result = searchSession.search( Book.class ) 
        .where( f -> f.matchAll() )
        .sort( f -> f.field( "pageCount" ).desc() 
                .then().field( "title_sort" ) )
        .fetchHits( 20 );

In this example i would like to avoid the string “pageCount” and replace it by metamodel, same thing for the sort wich is define by annotation in the entites.

I my current case i have to build multiple statistics widget who rely on some entities, filter, order, and aggregation. I don’t want to have string who depends on my transient field without check at compilation time because shit will happen eventually.

the old reason i wasn’t rely on native HSearch predicates is i wanted to use some lucenne syntax directly i my API, and now i have something i didn’t know to do with HSearch yet as search on multiple entities at sametimes with common field (like title)