-->
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: group by in Lucene search with hibernate
PostPosted: Mon Jul 18, 2011 1:18 am 
Newbie

Joined: Fri Apr 08, 2011 8:44 am
Posts: 8
Hi All,

I like to get filtered criteria with fullTextQuery.

Take below My code:
FullTextSession fSession = Search.getFullTextSession(session);
Criteria ct = fSession.createCriteria(clazz);
ProjectionList projList = Projections.projectionList();
projList.add(Projections.property("feedUrl"));
projList.add(Projections.count("feedUrl"));
projList.add(Projections.groupProperty("feedUrl"));
ct.setProjection(projList);
fullTextQuery=fSession.createFullTextQuery(lucenceQuery, c).setCriteriaQuery(ct);
fullTextQuery.list();


Here why the group by (groupProperty) function is not working. Since not geting any runtime/compile time exception.

Kindly help me to get resolve this ASAP.


Thanks,
John


Top
 Profile  
 
 Post subject: Re: group by in Lucene search with hibernate
PostPosted: Mon Jul 18, 2011 4:30 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi John,

you should avoid mixing and matching the Criteria API with the Search (fulltext query) API. In fact the documentation says:
Quote:
Only fetch mode can be adjusted, refrain from applying any other restriction.

We recommend to index all data you need for your searches and uses fulltext queries only. Obviously you are also interested in some aggregate functions which might require a different approach. This will depend on your usecase. Maybe Lucene Filters can help or faceting? Or maybe you should just use the Criteria API without the fulltext 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.