mathpere / grails-hibernate-search-plugin

Integrates Hibernate Search features to Grails
http://grails.org/plugin/hibernate-search
Apache License 2.0
21 stars 18 forks source link

How to use criteria clousure, i need more information about it #43

Open angelique360 opened 5 years ago

angelique360 commented 5 years ago

I need to use Restrictions, for example:

Restrictions: eq isNotNull

But i dont now how implement in search().list {} clousure

I am trying to do something like this:

def myDomainClasses = Book.search().list {

        criteria{
            Restrictions.isNotNull("id_author")
        }

}

pabloto88 commented 4 years ago

Hi @angelique360 , Did you resolve this problem? I have the same issue, I know that there is "Must" and "MustNot" but it doesn't work! I don't know what happen. I'm new in Grails and I'm working with a main entity and 4 childs entities.

angelique360 commented 4 years ago

Que onda amigo veo que eres de ecuador, mira a si logre hacer funcionar, ahí te van unos ejemplos:

criteria{ add(Restrictions.isNull("fechaBaja")) if(aseguradora){ add(Restrictions.eq("aseguradora",aseguradora)) } }

Saludos desde México