Hi all,
Can anyone assist in explaining to me how to modify a fulltext query I am using so that I can also add some 'WHERE' conditions to the query.
I currently have this query which acts on a 'Film' class. What I want to do is also say where a property called 'client' = a passed in parameter named client. In a normal query it would be something like "FROM Film f WHERE f.client = ?1" and set the client parameter accordingly. But I'm unsure how to do this when also using the lucene FTQ.
My FTQ looks like :
Code:
FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
// create native Lucene query
String[] fields = new String[]{"title", "description"};
MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
org.apache.lucene.search.Query query = parser.parse(search);
// wrap Lucene query in a org.hibernate.Query
FullTextQuery hibQuery = fullTextEntityManager.createFullTextQuery(query, Film.class);
hibQuery.setFirstResult(startPosition);
hibQuery.setMaxResults(maxResult);
// execute search
//List result = hibQuery.list();
results = hibQuery.getResultList();
Any advice greatly appreciated.
Thankyou