• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate Search(Lucene) additional Parameters  RSS feed

Dave Brown
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I've been using hibernate search quite successfully, but now I want to add a condition to the search query but since I'm not writing the query myself, I'm not sure how to do this..

My current code for the query is :

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);
// execute search
//List result = hibQuery.list();
results = hibQuery.getResultList();

And what I want to do is add a 'WHERE' type clause to the above in addition to the fulltextquery..

Anyone any ideas how to do this? I've noticed the hibQuery allows 'setParameter' but without being able to set a query string I'm not sure how it would work..

Thanks in advance.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!