-->
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 return distinct/unique results
PostPosted: Tue Aug 23, 2011 4:01 pm 
Regular
Regular

Joined: Tue May 17, 2011 1:45 am
Posts: 52
Hi ,

In my indexed data there is a field called Company. In my advanced search I want to do a type ahead where in when I type the company name it will display from the index. However since Lucene will return to me all matching results that has the company name, I need to ensure that the search returns only distinct company name.

Is this possible in hibernate search or we need to do faceting to achieve this?

Thanks,
David


Top
 Profile  
 
 Post subject: Re: How to return distinct/unique results
PostPosted: Wed Aug 24, 2011 4:45 am 
Hibernate Team
Hibernate Team

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

Quote:
In my indexed data there is a field called Company. In my advanced search I want to do a type ahead where in when I type the company name it will display from the index. However since Lucene will return to me all matching results that has the company name, I need to ensure that the search returns only distinct company name.


Lucene is not a database where you could work with DISTINCT. Lucene returns all documents matching the search query. One way of going about it would be to use projection on the company name (which is probably a good idea anyways) and remove duplicates from the results yourself. Depending on the number of company names it might make sense to use a db query to solve the problem as well.

Quote:
Is this possible in hibernate search or we need to do faceting to achieve this?


I don't think faceting will help. Faceting is about narrowing/categorizing the results of an executed 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.