Hello,
I'm new to Hibernate Search and I have a problem with creating the initial index.
In my application I use JPA to create the initial index for the class Userfood:
Code:
@javax.persistence.Entity
@Table(name = "foods", schema = "xy")
@Indexed
@FullTextFilterDefs( {
@FullTextFilterDef(name = "lockedFoods", impl = LockedUserfoodsFilter.class)
})
public class Userfood implements Serializable
{
@Id
@org.hibernate.search.annotations.DocumentId
@Column(name = "id")
private java.lang.Integer id;
...
@org.hibernate.search.annotations.IndexedEmbedded(prefix="")
@ManyToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE}, fetch = javax.persistence.FetchType.EAGER)
@JoinTable(name = "foods_ingredients", schema="xy",
joinColumns =
@JoinColumn(name="food_id", referencedColumnName="id"),
inverseJoinColumns =
@JoinColumn(name="ingredients_id", referencedColumnName="id"))
private Set<Ingredients> ingredientsSet;
...
}
Code:
@Entity
@Table(name = "ingredients", schema = "xy")
public class Ingredients implements Serializable {
@Id
@Column(name = "id")
@org.hibernate.search.annotations.Field(name="id", index=org.hibernate.search.annotations.Index.UN_TOKENIZED, store=org.hibernate.search.annotations.Store.NO)
private Integer id;
@Column(name = "text", nullable=false)
@org.hibernate.search.annotations.Field(name="ingredients", index=org.hibernate.search.annotations.Index.TOKENIZED, store=org.hibernate.search.annotations.Store.NO)
private String text;
@org.hibernate.search.annotations.ContainedIn
@ManyToMany(mappedBy="ingredientsSet")
private Set<Userfood> userfoods;
...
}
The Problem is that the initial index does not contain all entities of the class Userfood. A small number of entities were not indexed. Where could be the problem?
Could the problem be caused by the ingredients property in the Userfood class (IndexedEmbedded) ?
I'm looking forward for your help. I'm trying to solve this problem since one week :(