【发布时间】:2016-11-26 08:10:34
【问题描述】:
我的实体是这样的
public class event
{
String title;
String description;
String city;
}
我是 Spring data jpa 的新手,我想在用户输入“Hello Hyderabad Fest”时实现搜索功能 我希望标记大小的字符串并拆分为单词,并在搜索查询命中 db 的实体上的任何属性上找到任何单词匹配。
WHERE title LIKE '%Hello%' OR title LIKE '%Hyderabad%' OR title LIKE '%Fest%' OR description LIKE '%Hello%' OR description LIKE '%Hyderabad%' OR 描述 LIKE '%Fest%'city LIKE '%Hello%' OR cityitle LIKE '%Hyderabad%' OR city LIKE '%Fest%'
我们如何在 spring data jpa 中实现这一点。
- 我们能否在 Spring data jpa 命名查询中动态传递 where 条件
- 我们可以在 nosql dbs 中使用 lucene 类型的查询吗?
- 任何其他建议
提前致谢。
【问题讨论】:
-
可以分享一些例子
标签: spring postgresql hibernate lucene spring-data-jpa