Restrict search to component's field value with grails searchable plugin

207 views Asked by At

I have issue with restriction on component't field. My model structures are below

class Category {

    String name;
    String description;
    Date createDate

    static hasMany = [items: Item]

    static searchable = true
} 

and

class Item {

    String name
    String description
    Category category

    static belogsTo = Category

    static searchable = {
        name boost: 2.0
        description boost: 2.0
        category component: true

        content: spellCheck 'include'
    }
}

below is my query

def items = Item.search({
    must(queryString(key))
    must(term('$/Item/category/name', category))
    //must(term('Item.category.name', category))
}, sort: params.sort, order: "asc").results;

Here the search results always empty. Is there something I am missing? I tried with "." and the other "$" options and no luck.

0

There are 0 answers