Hi i need help to convert Hibernate criteria query to Lucene Full Text Query, this is possible?, this is my criteria query code
@Transactional(readOnly = true)
public List<Cliente> example(Cliente cliente){
Session session = em.unwrap(Session.class);
FullTextSession fullTextSession = org.hibernate.search.Search.getFullTextSession( session );
Criteria criteria = fullTextSession.createCriteria(Cliente.class);
Example example = Example.create(cliente)
.excludeZeroes()
.ignoreCase()
.enableLike(MatchMode.ANYWHERE)
.excludeProperty("idCliente");
criteria.add(example);
List result = criteria.list();
return result;
}
https://gist.github.com/ripper2hl/4875f55fefdd8640c507
Similar question -> Join hibernate search query with criteria query restriction , but in my case i need only restrictions for criteria query and the query get information in the lucene index, in my code example the query give the information directly from database.
Why i need criteria?, the fields on the entity can be null in the search for this reason i used Example queries --> http://docs.jboss.org/hibernate/orm/3.5/reference/en/html/querycriteria.html#querycriteria-examples
I need other solution ? (Evaluate manually what properties is null and create the Lucene Full Text Query ).