-->
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: Problem searching @IndexedEmbedded components
PostPosted: Mon Jan 06, 2014 7:53 pm 
Newbie

Joined: Mon Jan 06, 2014 7:34 pm
Posts: 1
Hello. With Hibernate Search 3.4.2, I'm trying to filter out child objects by an expiration date, but I can seem to find the right way of doing this.

In pseudo code, here's what I want to accomplish:
Code:
class System {
String code;
Set<Component> components;
}

class Component {
String code;
Date expirationDate;
}

In the DB, System ABC has Components 123 (not expired) and 124 (expired). When searching for 123, ABC is getting filtered because 124 is expired. But I only want ABC to be filtered if searching for 124.

Here's the paraphrased code:
Code:
@Entity
@Indexed
class System {
@Field
String code;

@ManyToMany(fetch = FetchType.LAZY)
@IndexedEmbedded
Set<Component> components;
}

@Entity
class Component {
@Field
String code;

@Field(store = Store.YES)
@DateBridge(resolution = Resolution.DAY)
Date expirationDate;

@ManyToMany(mappedBy = "components")
@ContainedIn
Set<System> systems;
}

The filter I'm using when searching Systems by code:

FieldCacheRangeFilter.newStringRange("components.expirationDate", null, "20131231", false, true);

Now when querying by 'code' with this filter, Systems are only returned that have 0 expired Components. I really want all Systems that have any unexpired Component with a code matching the search text.

Any help would be greatly appreciated. Thanks! -Bob


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.