I;'m having a problem with the searchable plugin (0.6.4).
My domain classes that are involved in my problem are these ones:
class AdminArea {
static searchable = true
String name
static belongsTo = [country:Country]
}
and (I have deleted non important fields):
class POI{
static searchable = {
adminArea component: true
}
String name
AdminArea adminArea
}
What I have in my app is a normal searchbar and a select that lets me choose the admin area so I can narrow the results a bit. To accomplish this, I have been trying to do the following:
In my searchable Controller, where I build the query:
def results = POI.search({
must{
queryString(searchTerm)
must(term('adminArea', params.adminArea))
}
})
I have tried with many combinations, like adminArea.id, adminArea.name, changing the values of the select in the gsp to ids, names.... but nothing seems to do the trick, I cant notice what I am missing.
I have found a way through rhis.. the queries in searchable are not good at all, so I have to came around and solve it like this:
def results = POI.search{
must(queryString(searchTerm + " AND adminArea.id: " + params.adminArea))
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.