For my Grails App i use Searchable Plugin to have an nice "google-like" Search.
I followed instructions and added:
class Address {
static searchable =true
Integer id
AddressGroups addressType
String briefDescription
String company
}
It really works fine. The Problem here is that the Searchbar in my App is searching through all Classes.
I know it is a simple Problem. But i found no Documentation for that issue. I just want to search one domain class at time. Not all classes.
More Information: Additionally i got an User Class and an AddressGroups Class. As you can see Addressgroups provides addressType for Address.
to only search for results of one type you can add an additional search term "alias:DomainClassName" (this has to be anded to the normal query) so it becomes
(searchterm) AND (alias:DomainClassName)
if you want the Person as a result if the term is found in the addressGroups you could define addressGroups as a component and make the addressgroups a non-root object for compass.
class Person {
AdressGroups addressType
static searchable = {
root true
addressType component: [prefix:'person_']
}
}
class AdressGroups {
static searchable = {
root false
}
}