-->
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.  [ 3 posts ] 
Author Message
 Post subject: Possible to filter a list of results based on a list of ids
PostPosted: Fri Aug 17, 2012 7:01 am 
Newbie

Joined: Thu Apr 05, 2012 6:19 am
Posts: 7
Hi Folks,

I have used Hibernate Search to retrieve a list of results successfully. I would not like to limit the list based on a list of ids that the logged-in user can see. Is there a way to do this with Hibernate Search directly?

I would filter them manually, but I am using pagination, so the total number of results would not match up (as I would get the total number of search results returned, rather than the total number of filtered results).

Thanks for your help
All the best,
Ash


Top
 Profile  
 
 Post subject: Re: Possible to filter a list of results based on a list of ids
PostPosted: Mon Aug 20, 2012 4:30 am 
Hibernate Team
Hibernate Team

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

filtering is the right idea. You would use a query filter as described here - http://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#query-filter.

The result size will be the result size of the filtered results.

--Hardy


Top
 Profile  
 
 Post subject: Re: Possible to filter a list of results based on a list of ids
PostPosted: Mon Aug 20, 2012 4:52 am 
Newbie

Joined: Thu Apr 05, 2012 6:19 am
Posts: 7
hardy.ferentschik wrote:
Hi,

filtering is the right idea. You would use a query filter as described here - http://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#query-filter.

The result size will be the result size of the filtered results.

--Hardy


Hi Hardy,

Thanks for the reply. I have just finished a workaround which is probably a better solution for my data. I have got hierarchical data and I'm using hierarchical sets (I can't remember the proper term :) ) in which I store a left and right value against each node. For our solution we want to be able to search down a branch of the tree (depending on where the user is logged in), so I used a range query + boolean junction.

I was having trouble getting the range query working until I added @NumericField to the field in question. I didn't realise it was needed.

Thanks for the answer, I'm sure I'll need to use the query filter in the future.

All the best,
Ash


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