-->
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: Search recommendations
PostPosted: Tue May 20, 2008 8:40 pm 
Beginner
Beginner

Joined: Wed Mar 05, 2008 10:32 am
Posts: 48
I'm plagued by a development issue. Should i return my search results as a list or a set?

I kind of want both! I know the criteria searching returns a list. Is there a way to return distinct values of that list? Should i just convert it to a set? I still want things to be ordered though and i'm afraid if i convert it to a set, i'll loose the order.

Does the Hibernate Search plugin ease this issue? I'm using basic e-commerce ordering (ASC, DESC) with pagination.

Also is there a criteria method to sort results based on how likely the results came back.. like by percentage?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 21, 2008 2:43 pm 
Beginner
Beginner

Joined: Wed Mar 05, 2008 10:32 am
Posts: 48
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);

I've used this to solve bit, but found another problem... my nested "OR" set isnt working properly.

here is my code.

Code:
criteria.add(Expression.or(Expression.or(Expression.or( Expression.ilike("firstName", query, MatchMode.ANYWHERE), Expression.ilike("lastName", query, MatchMode.ANYWHERE)),
Expression.ilike("login", query, MatchMode.ANYWHERE)   ),
Expression.ilike("email", query, MatchMode.ANYWHERE)));


Also whats the differnece between Expression and Restriction?


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.