I'm trying to create a lucene index for a model partly consisting of abstract classes. Let's say I want to index class A, which has a method to return a list of class B elements, which all has a object of abstract class C which has an abstract method getD() to return a list of class D elements. Class E and F extend class C and both implement method getD(), for which I created a FieldBridge implementation (implements StringBridge) to convert to result into text output to be used for the index.
The Hibernate search documentation is not very elaborate on how to deal with inheritance and how they can be used together with the @IndexedEmbedded annotation. I tried the naive approach of just providing c.getD as includePath, hoping that the getD implementations of the subclasses of c would automatically be used. This results in the following SearchException when running the server:
org.hibernate.search.SearchException: Found invalid @IndexedEmbedded->paths configured on class A, member vragen: b.c.getD
Doest anyone know how to set the search path or change the code in any other way in order to get the String created by the FieldBridge implementation in the index for class A? Code is provided below:
@Indexed
public class A {
@IndexedEmbedded(includePaths = { "c.getD" })
public List<B> getB() {
// Method implementation returning a list of B
}
}
public class B{
private C c;
}
public abstract class C{
public abstract List<D> getD();
}
public class E extends C{
@Field
@FieldBridge(impl = DListFieldBridge.class)
public List<D> getD() {
// Method implementation returning a list of D
}
}
public class F extends C{
@Field
@FieldBridge(impl = DListFieldBridge.class)
public List<D> getD() {
// Method implementation returning a list of D
}
}