Hello,
I have a problem building a query for an abstract entity.
the mapping is very simple:
Code:
public abstract class BaseClass ... (has some indexed fields)
Code:
@Indexed
public class ConcreteClass extends BaseClass ...(also has some indexed fields)
constructions such as :
Code:
this.fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(ConcreteClass.class).get();
work just fine.
I have just tried today to build a QB on the abstract class like this:
Code:
QueryBuilder qb = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(BaseClass.class).get();
it triggers an error, first lines:
Code:
java.lang.IllegalArgumentException: Entity for which to retrieve the scoped analyzer is not an @Indexed entity: *path/to/BaseClass*
at org.hibernate.search.impl.ImmutableSearchFactory.getAnalyzer(ImmutableSearchFactory.java:284)
at org.hibernate.search.query.dsl.impl.ConnectedQueryContextBuilder$HSearchEntityContext.<init>(ConnectedQueryContextBuilder.java:55)
at org.hibernate.search.query.dsl.impl.ConnectedQueryContextBuilder.forEntity(ConnectedQueryContextBuilder.java:46)
I don't explicitly set any analyzer on entities, I set a default one in hibernate properties:
Code:
<property name="hibernate.search.analyzer">org.apache.lucene.analysis.standard.StandardAnalyzer</property>
Is what i am trying to achieve illegal or is something wrong with my technique? If the former i guess i can workaround it by adding all concrete entities to QB, however it would be nice to be able to use polymorphism here.
[EDIT] Using hibernate-core v.3.6.0.Final and hibernate-search v.3.3.0.Final and hibernate-commons-annotations v.3.2.0.Final and lucene-core v.3.0.3
thanks,
val