-->
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: Filtering on a entity with a collection containing enum
PostPosted: Sat Aug 13, 2011 12:06 pm 
Newbie

Joined: Mon Oct 12, 2009 8:28 am
Posts: 2
Hello,

I have hibernate search working perfect in that it indexes everything and I can find all I require to.

I now wish to add some filters to the query / overall results such that I remove the items which are not applicable.

Entity1
Code:
@ElementCollection(targetClass = Type.class, fetch = FetchType.EAGER)
@Enumerated(EnumType.STRING)
private Set<Type> types = new HashSet<Type>();


Code:
FullTextQuery fq = fullTextEntityManager.createFullTextQuery(query, Entity1.class, Entity2.class, Entity3.class, Entity4.class);


I've read a bit about adding filters using
Code:
fq.enableFullTextFilter(arg0)


But haven't seen much in how I define my filter in the entity such that I can pass in a Type value and only get search results for that type.

Does anyone have any pointers please?

Chris


Top
 Profile  
 
 Post subject: Re: Filtering on a entity with a collection containing enum
PostPosted: Sun Aug 14, 2011 3:09 pm 
Hibernate Team
Hibernate Team

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

have you looked at FulltextFilderDef and the security filter example - http://docs.jboss.org/hibernate/stable/ ... ery-filter ?

You pass a parameter to the filter when you enable it:

Code:
fullTextQuery = s.createFullTextQuery( query, Driver.class );
fullTextQuery.enableFullTextFilter("security").setParameter( "level", 5 );


Also notice that there is no support for @ElementCollection yet. It is in the making though - https://hibernate.onjira.com/browse/HSEARCH-566
For now you need to write a custom bridge to index your element collection in case it plays a role in your filtering.

Hope this helps,
Hardy


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.