I have installed searchable plugin in my application in which I want to put a search box, searching items from my DB. I have modified the controller as following to search effectively. My Domain class looks like this
class User {
String category
String product
static searchable = true
}
and my controller where i have made changes looks like
def index(Integer max) {
def userList
def userCount
if (params.q) {
userList = User.search(params.q + "*").results
userCount = userList.size()
} else {
userList = User.list(params)
userCount = User.count()
}
params.max = Math.min(params.max ? params.max.toInteger() : 10, 100)
respond User.list(params), model:[userInstanceList: userList, userInstanceTotal: userCount ]
}
After running
No signature of method: java.lang.Integer.call() is applicable for argument types: ()
is coming.