2
votes

Sorry if the title is not that specific, but I don't know how else to state my problem. I'm using the searchable plugin and everything was fine until I needed to search for information that is on a domain associated by a hasMany - BelongsTo.
Example:
I have two classes:

class Author {
  String name
  static hasMany = [books: Book]
  static searchable = true
}

And

class Book {
  String name
  static belongTo = [author: Author]
  static searchable = true
}

I need to be able to search a book given either it's name or author.
But when calling Book.search(query, [properties:['name', author]]) just the name of the Book is searched, but never the Author.
I have tried with author component: true(on Book class), root:false (on Author class) with no luck.

This issue already costed me hours, and I was sure it had to be something simple to implement.

1

1 Answers

1
votes

Did you tried to replace name with author.name, should work, refer to documentation on wiring domains in order to be searchable, also luke is a good tool for testing your queries, I couldn't get it right without this tool http://code.google.com/p/luke/downloads/detail?name=lukeall-3.5.0.jar&can=2&q=