Assume, we have three classes
Code:
@Indexed
class A {
@Field...
private String name;
}
@Indexed
class B extends A {
@Field...
private String notes;
}
@Indexed
class C extends A {
@Field...
private String abbrev;
}
How do I have to build my query parser in order to do a search within all fields of this class hierarchy?
When I create a query based on the following code, I get an error, that notes is not in the index of A.class:
Code:
QueryBuilder qb = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(A.class).get();
String[] fields = new String[]{"name", "notes", "abbrev"};
org.apache.lucene.search.Query query = qb.keyword().onFields(fields).matching(q).createQuery();
org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(query);
Thanks in advance!