Hi,
I'm using hiberntae search 3.3.0, and I need to now how to implement filter @IndexedEmbedded, @OneToMany collection that can be null.
I have a Person entity:
Code:
@Entity
@Table(name = "person"))
@Indexed(index="Person")
@FullTextFilterDefs( {
@FullTextFilterDef(name="profileFilter", impl=ProfileFilter.class)
})
public class Person implements java.io.Serializable {
private List<Profile> profiles = new ArrayList<Profile>(0);
@OneToMany(fetch = FetchType.LAZY, mappedBy = "person")
@IndexedEmbedded
public List<Profile> getProfiles() {
return this.profiles;
}
...
This is the Profile entity:
Code:
@Entity
@Table(name = "profile")
@Indexed(index="Profile")
public class Profile implements java.io.Serializable {
private Person person;
private long organizationId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "person_id")
@ContainedIn
public Person getPerson() {
return this.person;
}
@Column(name = "organization_id", nullable = false)
@Field(index = Index.UN_TOKENIZED, store = Store.YES)
public long getOrganizationId() {
return this.organizationId;
}
I need to enableFullTextFilter with logic ( profile.organizationId == 5 || person.profiles == null). I want to search for persons that don't have profiles or if they have profiles has to be with organizationId == 5. How can be this achieved in hibernate search 3.3.0?