开发者

Including boolean property check in Search Query builder with Grails Searchable Plugin

I am trying to limit my search criteria to return entities with a boolean property set开发者_JAVA百科 to true. For example

class Product {
  def name
  Boolean enabled
}

How can I do it using a search query builder, my simple search so far is:

Product.search(query, analyzer: 'whitespace')

I tried using query builder with term but it does not work:

Product.search {
  must(queryString(query))
  must(term('enabled',true))
}

Any ideas? Thank you.


It'll be the spelling error ("available" vs. "enabled").

According to this thread anyway, your syntax is correct.


I was using 0.5.5.1 version of searchable plugin. After updating to the latest 0.6 SNAPSHOT enabled field is being picked up like it supposed to and results are accurate. Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜