Summary When using @IndexedEmbedded on a class, that target classes @Id is not indexed if it is defined in a @MappedSuperclass. Details For (a very cut down version of my production code) example, GenericEntity is the superclass of all my entities, so id is always defined (and generated in my code)
@MappedSuperclass
public abstract class GenericEntity implements Serializable {
@Id
private Long id;
}
Then I have classes that extend on this. The first being Project
@Entity
@Indexed
public class Project extends GenericEntity {
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
private String title;
@Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
private String description;
@IndexedEmbedded
@ManyToOne
private Config config;
}
And then there's Config
@Entity
public class Config extends GenericEntity {
}
All I care about in Config is id. In my search query, I want to return all Project objects that are constrained where config.id = <fixed value>. Actual Results I've tried both the deprecated Filter method, and the preferred bool(), but neither work because as you can see in Luke, that config.id is never indexed.
Expected Results Using either method I should be able to filter/limit results with an @Id of a @MappedSuperclass. |