Using grails searchable plugin, I would like to search for all products within a specific category using a query builder like:
Products.search {
must(queryString(params.q))
must(term('??????','Food'))
}
Using 'category.name' returns: Failed to find mapping for alias [category] and path [category.name]
class Product {
String name
String desc
Category category
static searchable = {
category component: true
}
}
class Category {
String name
static hasMany = [products: Product]
static searchable = true
}
Any ideas? Thanks.