0

Using searchable plugin with grails 2.3.4 and a postgreSql datasource. The plugin can't render the result when i build a query with a closure:

1) Having a domain Test:

import org.compass.annotations.*

class Test implements Serializable {
    static searchable = true

    @SearchableProperty
    Currency currency

    @SearchableProperty
    String type

2) A service which wires searchableService:

class SearchService {

    def searchableService

    def mysearch() {
       def results = Test.search{
           must(term('type', 'OFFICES'))
           term('currency', 'USD')
       }
       return results
    }

In spite of the well recorded Test entity with string values 'OFFICES' and 'USD' for type and currency properties, the query builder can't find any result...

Burt Beckwith
  • 75,342
  • 5
  • 143
  • 156
ludo_rj
  • 3,877
  • 1
  • 18
  • 37
  • ...because Currency is not of type String as specified in your criteria? – stefanglase Dec 22 '13 at 20:28
  • Currency is an enum in the domain, but a character var in database. I thought the same at first glance, but same result with type only which is defined as a String.. – ludo_rj Dec 22 '13 at 22:08
  • for info, using must(queryString("OFFICES")) returns the target entity... but i need to use a complex query so i wish i could put terms in a closure. – ludo_rj Dec 23 '13 at 11:05
  • transforming the search in: "must(term('type',values['type'].toLowerCase()))" did the job, but it's odd that compass can't represent the string as it's recorded in db – ludo_rj Dec 23 '13 at 23:05

0 Answers0