Hello,
I want to make a request like this using the QueryBuilder ( new in hibernate search ).
" state:hidden OR state:frozen OR state:published AND hidden:false "
I try something, but it's not working :
Code:
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
FullTextSession ftSession = Search.getFullTextSession(sessionFactory.getCurrentSession());
QueryBuilder mythQB = ftSession.getSearchFactory().buildQueryBuilder().forEntity( Product.class ).get();
String[] states = {"frozen","published"};
BooleanJunction<BooleanJunction> b = mythQB.bool();
for (String state : states) {
b.should(
mythQB.keyword().onField("state").matching(state).createQuery()
);
}
b.must(
mythQB.keyword().onField("hidden").matching(String.valueOf(hidden)).createQuery()
);
Also, is it possible to view the query passed to lucene using the query builder ?