Can index definition be overridden?

I have been working on integrating Hibernate Search using the Standalone POJO Mapper in order to replace an old custom implementation.

Initially it is going well but I came up with an issue that it is related to the following ticket:

That question is almost 4 years old. So, my question here is the same, using Hibernate Search and having inheritance annotation configuration like the following:

public class Person {
private final String value;
@GenericField(searchable = Searchable.YES, projectable = Projectable.YES)
    public String getValue() {
        return value
    }

}
public class PersonB extends Person {
 @GenericField(searchable = Searchable.NO, projectable = Projectable.NO, sortable = Sortable.NO, aggregable = Aggregable.NO
    public String getValue() {
        return super.getValue()
    }

}

Now when I try to index PersonB I am having a duplicated index error:

- HSEARCH400520: Duplicate index field definition: 'value'. Index field names must be unique. Look for two property mappings with the same field name, or two indexed-embeddeds with prefixes that lead to conflicting index field names, or two custom bridges declaring index fields with the same name.
	at org.hibernate.search.engine.reporting.spi.RootFailureCollector.checkNoFailure(RootFailureCollector.java:63)
	at org.hibernate.search.engine.common.impl.SearchIntegrationBuilder.prepareBuild(SearchIntegrationBuilder.java:181)
	at org.hibernate.search.mapper.pojo.standalone.bootstrap.impl.StandalonePojoIntegrationBooterImpl.doBootFirstPhase(StandalonePojoIntegrationBooterImpl.java:112)
	at org.hibernate.search.mapper.pojo.standalone.bootstrap.spi.StandalonePojoIntegrationBooterBehavior.bootFirstPhase(StandalonePojoIntegrationBooterBehavior.java:18)
	at org.hibernate.search.mapper.pojo.standalone.bootstrap.impl.StandalonePojoIntegrationBooterImpl.getPartialBuildStateOrDoBootFirstPhase(StandalonePojoIntegrationBooterImpl.java:84)
	at org.hibernate.search.mapper.pojo.standalone.bootstrap.impl.StandalonePojoIntegrationBooterImpl.boot(StandalonePojoIntegrationBooterImpl.java:133)
	at org.hibernate.search.mapper.pojo.standalone.bootstrap.impl.StandalonePojoIntegrationBooterImpl.boot(StandalonePojoIntegrationBooterImpl.java:38)
	at org.hibernate.search.mapper.pojo.standalone.mapping.SearchMappingBuilder.build(SearchMappingBuilder.java:96)

In summary:

  • Is there a way that I am missing to make this inheritance configuration works?

Hey @Damian

Thanks for reaching out. I’m afraid the answer remains the same as in the linked question.
And from the example you’ve shared, you are trying to disable features enabled by the superclass index, so that won’t play nice even if you try the binder approach…