Hi
This is my sample Full Text quey with full text index on Mediafile object.
public void dbuserFullTextQuery(){
try {
Session session = getHibernateTemplate().getSessionFactory().openSession();
FullTextSession fullTextSession = Search.createFullTextSession(session);
Transaction tx = fullTextSession.beginTransaction();
MultiFieldQueryParser parser = new MultiFieldQueryParser( new String[]{"title"}, new StandardAnalyzer());
Query query = parser.parse("chapel");
org.hibernate.search.FullTextQuery hibQuery = fullTextSession.createFullTextQuery( query, Mediafile.class );
List result = hibQuery.list();
tx.commit();
}catch(Exception e) {
e.printStackTrace();
}
}
Below is my real query which i am trying to convert it to full text query.
this query has join to other tables like mime, datastore.
String hql = "select new edu.princeton.almagest.viewObjects.MediaItems (media.mediafileId,media.title,rfds.datastore,media.filename,media.thumbfilename,mime.mimetype,media.archiveByArchiveId.archiveId)"
+ " from Dbuser ws "
+ " join ws.mediafilesByDbuserId media "
+ " join media.mimetype mime "
+ " join media.refDatastore rfds "
+ " where media.title like :searchString ";
Can some one guide me, how do i write above query so that it can be benefitted from full text index i have created on Mediafile table?
My problem is i don't know how to write join statements with full text query.
I know i can fire 2 queries. One to get ids using full text query and second query will use those ids to restirct the output of second query. But is there any way to combine full text query with join statements?
|