-->
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: projections for list of distinct items and counts...?
PostPosted: Wed Aug 31, 2011 3:36 pm 
Regular
Regular

Joined: Fri Jul 30, 2004 4:02 pm
Posts: 50
Hey all,
I may not be using the best description/verbiage for the problem as I haven't been able to find an example on my own (and I am new to hibernate search):

Given a large resultset that has, say 4 relevant fields. Each of the fields may have a much smaller set of distinct values, but aren't necessarily FK's as it could contain freeform information.

So given an example table for the problem:
person |age | favorite color | searchengine | ide | programminglanguage

I may want to return all results for a given age range (30-40 for example), and then want to view all the distinct available colors and counts, distinct available searchengine and counts, distinct available ide and counts, and distinct programming languages and counts.

Looking for an efficient method to handle this problem, and rather than writing a bunch of SQL scripts and working the database was curious if Hibernate Search with a local lucene index (and stored values) would be better able to solve this problem in a more maintainable fashion?

thanks for any feedback,
-D


Top
 Profile  
 
 Post subject: Re: projections for list of distinct items and counts...?
PostPosted: Wed Aug 31, 2011 5:35 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
yes Lucene if very efficient to count term frequencies.
You could implement something like this using the Faceting API

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: projections for list of distinct items and counts...?
PostPosted: Thu Sep 01, 2011 10:33 am 
Regular
Regular

Joined: Fri Jul 30, 2004 4:02 pm
Posts: 50
Excellent, that is what I'm looking for, thank you!! (it's all about the right keyword/term)


Question, can you reuse a jpa query or jpa2 criteria query with Facets, or is it limited to only with the Hibernate Search QueryBuilder?

i.e., I already have queries built with named queries and/or jpa2 criteria, but want to add facets. I am attempting to convert them to equivalent search querybuilders, but there are some mis-matches here and there where the Facet may not match the original query result.


Top
 Profile  
 
 Post subject: Re: projections for list of distinct items and counts...?
PostPosted: Thu Sep 01, 2011 1:16 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
Question, can you reuse a jpa query or jpa2 criteria query with Facets, or is it limited to only with the Hibernate Search QueryBuilder?


No, the two are different: you either run a fulltext query or a criteria query, they are send to two different query engines.

You can set a criteria for a fulltext query, but only to optimize the loading (join fetch), not to add restrictions.

_________________
Sanne
http://in.relation.to/


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.