关于 grails 可搜索插件的更多信息

发布于 2024-08-25 03:11:07 字数 726 浏览 3 评论 0原文

我有两个简单的域:

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"
    }
}

我是可搜索插件的新手,但我相信它可以帮助我解决我的问题。 因此,任务是按城市查找酒店,然后按名称对结果进行排序。无需排序,借助动态查找器的帮助即可轻松完成,但是...

摘要:

  1. 按城市查找酒店。
  2. 按酒店名称(针对给定语言)对结果进行排序。
  3. 支持分页。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

峩卟喜欢 2024-09-01 03:11:07

公共类酒店 {

static searchable = {
     hotelTexts component: true
}

...

}

公共类 HotelText {
静态可搜索 = {
名称提升:2.0
}

...

}

public class Hotel {

static searchable = {
     hotelTexts component: true
}

...

}

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

...

}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文