Hello,
Before anything else, just wanted to say Search is awesome, so thank you.
I'm having an issue with the @ClassBridge defined on an interface not inheriting to the implementing classes. I currently have a setup like the one below (simplified):
Code:
@ClassBridge(name="MY_BRIDGE",
store=Store.YES,
impl=MyChild.MyChildClassBridge.class)
public interface MyChild {
public class MyChildClassBridge implements FieldBridge {
@Override
public void set(String name, Object value, Document document,
LuceneOptions luceneOptions) {
String fieldValue = ((MyChild) value).getConcatGroup();
if(fieldValue == null){
fieldValue = "";
}
org.apache.lucene.document.Field field =
new org.apache.lucene.document.Field(
name, fieldValue, luceneOptions.getStore(),
luceneOptions.getIndex(), luceneOptions.getTermVector());
field.setBoost(luceneOptions.getBoost());
document.add(field);
}
}
public String getConcatGroup();
}
@Entity
@Indexed
public class Pete implements MyChild{
@Id @GeneratedValue
private long id;
/**** .... simplified *****/
public String getConcatGroup(){
return "some string";
}
}
Now I expected that the Pete class would inherit the ClassBridge defined on MyChild and thus I would see and index of the name "MY_BRIDGE". However when I reindex and inspect with Luke it doesn't show up. If I move the ClassBridge from the interface (MyChild) and define it directly on the Pete class then the index shows up as expected. Scouring the interwebs I only came upon the following:
https://hibernate.atlassian.net/browse/HSEARCH-249 (6 years old, unresolved)
http://stackoverflow.com/questions/17116839/how-does-hibernate-search-handle-annotations-inherited-from-a-superclass
http://stackoverflow.com/questions/1413558/hibernate-search-annotations-not-inherited
(contributions from sirs Emmanuel, Sanne, and Hardy) which also pointed to some hibernate forum posts.
Emmanuel (in the JIRA) and a SO poster seemed to indicate that the inheritance should work. Is this not the case, does it only work on actual super classes and not interfaces?, or do I have something incorrectly configured?
Many thanks in advance for any help.