-->
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: Hibernate Search + Range Query + date collection
PostPosted: Mon Sep 06, 2010 4:09 am 
Newbie

Joined: Tue Mar 02, 2010 4:28 pm
Posts: 8
Hello,

I'm trying to add hibernate search to a simple relational schema.

The main entity is Pharmacy having a collection of dates(care planning):
Code:
@Entity
@Indexed
public class Pharmacy implements Serializable {
@field
private int id;
@field
private String title;
@field
private String adress;
...
@Analyzer(definition = "customAnalyzer")
@IndexedEmbedded
@OneToMany(cascade = CascadeType.ALL)
private List<CareDate> careDates;
//getters, setters, equal...
}


the CareDate is a specific date where the pharmacy still opened at night (night care) or 24 or some other types of care
Code:
public class CareDate implements Serializable{
@id
private int id;
@field
private String beginDate;
@field
private String endDate;
@field
private String careType;

@JoinColumn(name = "id", referencedColumnName = "id", insertable = false, updatable = false)
@ManyToOne
private Pharmacy caringPharmacy;
...
}


the problem now is that when i want to check which pharmacy has a care date in a given date, let's say 2010-09-10 (yyyy-mm-dd); I tryed to combine two range queries :
Code:
+careDates.beginDate:[2010-09-10 TO *] +careDates.endDate:[* TO 2010-09-10]


the result is not correct when the collection contains two separate CareDate verifying separately the condition as the collection is combined when indexed; I mean this pharmacy may have two care dates([beginDate to endDate]):
[2010-09-01 to 2010-09-08] and [2010-09-12 to 2010-09-15]
here the given date is not included in any of those intervals but Lucene does not have the same point of view!!!
because the first interval validates the second part of the query and the second validates the first part.
any one has an idea? how can i deal with date range when i have such collections?

Thanks.


Top
 Profile  
 
 Post subject: Re: Hibernate Search + Range Query + date collection
PostPosted: Mon Sep 06, 2010 6:51 am 
Newbie

Joined: Tue Mar 02, 2010 4:28 pm
Posts: 8
Just some workaround but not a real solution. As Lucene is not that mature outside textual search, we tryed to morph the situation to get a textual search query. As intervals where short, we enumerated all values in this interval in another field and did a transparent search in this field.


Top
 Profile  
 
 Post subject: Re: Hibernate Search + Range Query + date collection
PostPosted: Wed Oct 19, 2011 12:58 am 
Newbie

Joined: Wed Oct 19, 2011 12:45 am
Posts: 5
Please tell me how to specify a non-pk member as document id, which is unique but it is not a pk field. When I tried this the property which is specified as document id is overwritten by the value of pk.


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.