-->
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.  [ 4 posts ] 
Author Message
 Post subject: Subtypes in Searches
PostPosted: Wed Jan 23, 2008 8:53 pm 
Newbie

Joined: Thu Dec 13, 2007 8:18 pm
Posts: 4
Hibernate version:
3.x

So we have a base type and then a bunch of derived types. These are all types of content. We need to be able to do searches, but then we want to be able to group the results into subtype buckets. The base is called Post, the subtypes would be Discussion, Article, Blog, etc. Is there an elegant way to do this? Short of doing something like grouping on the discriminator column in the base class?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 6:02 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Can you clarify your problem a little. When you search 'search' do you mean Hibernate Search (Hibernate + Lucene) or plain HQL or JPA?

If you are talking about HQL then a group by on the discriminator column should work.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 24, 2008 10:27 am 
Newbie

Joined: Thu Dec 13, 2007 8:18 pm
Posts: 4
Yes the search is going to be a text search, e.g. look for the word salmon, and have it find mention in blogs, discussions, stories, etc. So the question is how to see results grouped properly by subtypes.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 12:23 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It depends what you want to achieve.
If you want to find the best matches globally and then split them by subtype, a split routine written in Java post Hibernate Search query is the right approach.
If you want to find the best matches for each category, then one query per category is probably best (ftem.createFTQuery(luceneQuery, Blog.class) ...)
Remember, Lucene queries are cheap.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.