I'm currently working on a project that involves the use of Hibernate Search. Currently the project uses pure SQL for its searches and we would like to use a text search instead (Needing to know and correctly spell the first word can get annoying).
The schema is that a product can have multiple versions and the current version contains the name of the product.
Public Class Product extends ProgEntity
{
private List<ProductVersion> versions = new ArrayList<ProductVersion>();
...
}
Public Class ProductVersion extends ProgEntity
{
String productName;
...
}
I need to be able to search for a product based on its name. I was able to index the ProductVersions by productName with little issue however indexing Product is proving to be more of an issue.
After some research this is what I have however when I update the product to the DB no index is created.
@Entity
@Indexed
Public Class Product extends ProgEntity
{
@IndexedEmbedded
private List<ProductVersion> versions = new ArrayList<ProductVersion>();
...
}
@Entity
@Embeddable
Public Class ProductVersion extends ProgEntity
{
@Field
String productName;
...
}
The DocumentID is part of ProgEntity. I need to be sure that if I update Product or Product Version that it will be indexed properly which does not seem to be happening now.
Any suggestions on what I am doing incorrectly?