2 Search rules - leandrogehlen/grails-search-fields GitHub Wiki

Search rules should be defined in domain class. For example:

Class Author:

class Author {
    String name
    String lastName
    Date birthday  

    static searchFields = [
        fields : [
            'name', 
            'lastName', 
            'birthday'
        ],      
        defaultField : 'name', //default filter field 
        defaultSort : 'name'
    ]
}

Class Book:

class Book {	
	String title
	String ISBN
	Date releaseDate	

	static belongsTo = [author: Author]
	
	static searchFields = [
		fields: ['title', 'ISBN', 'releaseDate', 'author_name']							
	]	
}