I have 2 domain classes
class Post {
String name
}
class PostMeta {
String key
String value
Post post
}
What I want to do, is a search using only one field "query", that returns all the Posts where "value" of PostMeta match with the query. The list of Posts must not contains duplicated elements
Try this
def findPostsByValue(String criteria) {
render PostMeta.createCriteria().list {
projections {
distinct("post")
}
ilike "value", "%${criteria}%"
}*.name
}