|
Since I only need discrete faceting I've changed method signature to public String getIndexingId() and now it's working. Thanks!
To be honest, I am not 100% I understand your current workaround. If you like post the full entities here.
@Entity
@Indexed
@Table(name = "phrase")
public class Phrase extends BaseEntityUnversioned {
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "phrase_tag",
joinColumns = @JoinColumn(name = "phrase_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "tag_id", referencedColumnName = "id"))
@IndexedEmbedded(includeEmbeddedObjectId = false)
public Set<Tag> getTags() {
return tags;
}
}
@Entity
@Table(name = "tag")
public class Tag extends BaseEntityUnversioned {
@Transient
@Facet(forField = "iid")
@Field(name = "iid", index = Index.YES, analyze = Analyze.NO, store = Store.YES)
public String getIndexingId(){
return String.valueOf(getId());
}
}
@MappedSuperclass
public class BaseEntityUnversioned extends com.phrask.model.common.BaseEntity<Long> {
@Id
@DocumentId
@GeneratedValue(strategy = GenerationType.IDENTITY)
public Long getId() {
return super.getId();
}
}
So in my app all entities extend BaseEntityUnversioned where public Long getId() and some other common stuff is declared. Before 5.3.0 I was just good setting @IndexedEmbedded(includeEmbeddedObjectId = true) on mapping on Phrase.java. But now I have to add this public String getIndexingId() method to Tag.java just to enable faceting over tag id. I don't want all my indexed entities to have faceting enabled on their document id so I don't want to change BaseEntityUnversioned to add @Facet there.
So in my opinion the best approach would be to have something like @IndexedEmbedded(includeEmbeddedObjectId = true, facetEmbeddedObjectId = true). But I guess it is a feature request.
|