One's more about grails searchable plugin
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:
- Find hotels by city.
- Sort result by hotel name(for given language).开发者_C百科
- Support pagination.
public class Hotel {
static searchable = {
hotelTexts component: true
}
...
}
public class HotelText { static searchable = { name boost: 2.0 }
...
}
精彩评论