-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to search based on categories?
PostPosted: Wed Nov 21, 2012 6:44 am 
Newbie

Joined: Wed Sep 19, 2012 12:37 pm
Posts: 1
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


Top
 Profile  
 
 Post subject: Re: How to search based on categories?
PostPosted: Fri Nov 23, 2012 6:41 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
http://stackoverflow.com/questions/13486751/how-to-apply-where-clause-on-manytoone-join-field-on-hibernate-search/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.