I have Product table and it has fields of Name,SKU,Description and Product category(ManyToOne Relationship with Product category table). I Indexed Product table Using Hibernate Search na d written following code to perform search.
Code:
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search
.getFullTextEntityManager(getEntityManager());
QueryBuilder qb = fullTextEntityManager.getSearchFactory()
.buildQueryBuilder().forEntity(Product.class).get();
org.apache.lucene.search.Query query = qb.keyword().fuzzy()
.onFields("name", "sku", "uniqueid", "description")
.matching(value).createQuery();
javax.persistence.Query persistenceQuery = fullTextEntityManager
.createFullTextQuery(query, Product.class);
Now i would like to add where condition on Product category. For Ex: I would like to search only the products where productCategory.Id=101.
Could any one suggest me how can i do this?
Thanks & Regards
Vijay