-->
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.  [ 1 post ] 
Author Message
 Post subject: How to filter on large number of ids
PostPosted: Tue May 22, 2012 12:07 pm 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Hi,

I am developing an app where people have a central "wall" where one can see
1 all the posts of people that are in your network that are posted to the wall
2 all the posts of people that are not in your network but in a group that you participate in
3 all the posts of people that are in your network that are posted to a group that you are not a member of but that allows posts to be viewed by the public

Potentially, networks an grow big and group membership can also grow big.
Right now, I implement part 1 by using a FullTextFilter that does something like this:

Code:
@Factory
   public Filter getFilter() {

BooleanQuery bq = new BooleanQuery();
for(Long i : usersWithXInNetwork){
   bq.add(new TermQuery(new Term("user.id", i.toString())), Occur.SHOULD);
}

   return new CachingWrapperFilter(new QueryWrapperFilter(bq));
}


where user.id is the userId of the user posting a post.

However, I'm not entirely sure if this is the best way to filter the posts as the loops can become quite large.
Also, it becomes a lot harder when I also want to filter on group aspects.

On a Post level we have fields available such as
* user.id
* group.id

On a User level we have fields available such as
* group.id

Any suggestions?
Cheers,
Marc


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.