Hi,
I am implementing a full text research with HIBERNATE SEARCH.
I want to make a full text research on the "value" property of my object Itemdata
Code:
@Indexed
public class ItemData {
/**
* Item Data Id
*/
@DocumentId
protected long itemDataId;
/**
* Item data value
* The data collected for an item. This data is represented according to DataType
* attribute of the Item.
*/
@Field
protected String value;
/**
*
.........
}
When I am going to run the search I will get a list of results
Code:
List<Itemdata> results = hibQuery.list();
Among this list I want to keep only the Itemdatas that are accessible to the connected user.
In my database, it corresponds to the following request :
Code:
select idat.*
from itemdata idat, itemgroupdata igdat, formdata fdat, eventdata edat, subject sbj, sites si, study s,groups grp, groups_users grpu, user usr
where idat1.ITEM_GROUP_DATA_ID=igdat.ITEM_GROUP_DATA_ID
and igdat.FORM_DATA_ID=fdat.FORM_DATA_ID
and fdat.EVENT_DATA_ID=edat.EVENT_DATA_ID
and edat.SUBJECT_ID=sbj.SUBJECT_ID
and sbj.SITE_ID=si.SITE_ID
and sbj.PROJECT_ID=s.PROJECT_ID
and s.study_id=grp.study_id
and grp.group_id=grpu.group_id
and grpu.user_id=usr_id
and usr.site_id=sbj.site_id
and usr.user_id=234;
As you can see the request is very complexe.
If I want to build a HIBERNATE SEARCH Filter on top of my HIBERNATE SEARCH query, to obtain this restriction, I don't know how to implement it.
According to what I read, Filters on HIBERNATE SEARCH can be implemented from several properties that are indexed by HIBERNATE SEARCH.
For example select the cars which color is blue, or select a car that is owned by a man living in los Angeles.
But in my case to implement a filter would suppose that I indexe the whole relation between an Itemdata and a user. It's impossible.
Has anyone an idea how I can build a such Filter ?
The best solution might be to Collect all the Itemdata accessible to the user by a database request and then make an intersection with my HIBERNATE SEARCH result
Can anyone help me ? Thank you in advance.