开发者

One's more about grails searchable plugin

开发者 https://www.devze.com 2022-12-23 10:06 出处:网络
I have two simple domains: public class Hotel { static searchable = true Source source City city HotelType type

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

精彩评论

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