views:

193

answers:

1

Hi. I have two simple domains:

public class Hotel {
 static searchable = true
 Source source
 City city
 HotelType type
 long sourceid
 float lat
 float lon
 static hasMany = [hotelTexts:HotelText]
 static mapping = {
  hotelTexts batchSize:10
  }
}

public class HotelText {
    static searchable = true
    static belongsTo = [hotel:Hotel]
    String lang
    String name
    String description
    String address
    static mapping = {
        batchSize:10
        description type:"text"
    }
}

I'm totally new in searchable plugin but i believe that it could help me with my problem. So, the task is to find Hotels by city and then sort result by name. Without sorting it could be easily done with dynamic finders help but...

Summary:

  1. Find hotels by city.
  2. Sort result by hotel name(for given language).
  3. Support pagination.
+1  A: 

public class Hotel {

static searchable = {
     hotelTexts component: true
}

...

}

public class HotelText { static searchable = { name boost: 2.0 }

...

}

Tseveen