I am trying to use the QueryBuilder from Hibernate Search with a field which is not a property of the respective Entity but rather constructed on the fly using an ClassBridge. Can I do that?
QueryBuilder qb = fullTextEntityManager.getSearchFactory().
buildQueryBuilder().forEntity(Publication.class).get();
....
Query query = qb.keyword().onField("title").matching("Lärm").createQuery();
The field "title" is not part of the Publication class but is available (and searchable) in the Lucene Index.
UPDATE: According to https://forum.hibernate.org/viewtopic.php?f=9&t=1008943, the following works:
QueryBuilder qb = fullTextEntityManager.getSearchFactory().
buildQueryBuilder().forEntity(Publication.class).get();
....
Query query = qb.keyword().onField("title").ignoreFieldBridge().matching("Lärm").createQuery();
(ignoreFieldBridge did the trick)