0

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.

user3043084
  • 21
  • 1
  • 2
  • Are you sure that your index is built properly? Quite often, it is that trivial. – sola Jan 03 '14 at 11:52
  • Thanks for your reply. How can I verify this? Other fields, I am able to search. So it should be doing – user3043084 Jan 04 '14 at 00:10
  • Make a call to searchableService.reindex() from a controller you create specifically for reindexing. Possibly, the Searchable plugin provides such a controller, I am just not aware of it. – sola Jan 05 '14 at 16:22
  • I had put searchableService.reindexAll() before search, but no luck. – user3043084 Jan 07 '14 at 21:03

0 Answers0