Question regarding querying an association with Compass.
Hello,
I'm having troubles using compass to query an association. I don't have control over the database schema, so I'm forced to adhere to this domain representation:
class Genre {
static searchable = [only:['id']]
Integer id
String name
Set entries = new LinkedHashSet()
//etc.
}
class Entry {
static searchable = [only: ['title', 'content', 'category']]
Genre category
String title
String content
//etc.
}
I'd like to be able to perform full-text queries on Entries such that I can restrict the results to a category.
I've searched around quite a bit, and I'm still stumped.
I've tried all the variations on
def searchResult = Entry.search {
queryString("query string")
term("category.id", 1)
}
etc.
I'd appreciate it if someone would point out where I'm going wrong.
Thanks!
Joe