开发者

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:

  1. Find hotels by city.
  2. Sort result by hotel name(for given language).开发者_C百科
  3. Support pagination.


public class Hotel {

static searchable = {
     hotelTexts component: true
}

...

}

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

...

}

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜