Grails searchable plugin with hasMany

Posted by user2624442 on Stack Overflow See other posts from Stack Overflow or by user2624442
Published on 2014-06-05T21:22:25Z Indexed on 2014/06/05 21:24 UTC
Read the original article Hit count: 123

Filed under:
|
|

I am using grails searchable plugin to search my domain classes. However, I cannot yet search by my hasMany (skills and interests) fields even though they are of the simple type String. This is my domain class:

class EmpactUser {

static searchable = [except: ['dateCreated','password','enabled','accountExpired','accountLocked','passwordExpired']]

String username
String password
boolean enabled = true
boolean accountExpired
boolean accountLocked
boolean passwordExpired

String email
String firstName
String lastName

String address
String phoneNumber
String description

byte[] avatar
byte[] resume

Date dateCreated

    static hasMany = [
        skills : String,
        interests : String, // each user has the ability to list many skills and interests so that they can be matched with a project.
]

static constraints = {
    username blank: false, unique: true
    password blank: false
    email email: true, blank: false

    firstName blank: false
    lastName blank: false

    description nullable: true
    address nullable: true
    avatar nullable: true, maxSize: 1024 * 1024 * 10
    resume nullable: true, maxSize: 1024 * 1024 * 10
    phoneNumber nullable: true, matches: "/[(][+]d{3}[)]d+/", maxSize: 30
}




}

This is the code I am using to search:

def empactUserList = EmpactUser.search(
            searchQuery,
            [reload: false, result: "every", defaultOperator: "or"])

Am I missing something?

Thanks, Alan.

© Stack Overflow or respective owner

Related posts about grails

Related posts about plugins