如何在休眠搜索中像查询一样执行SQL IN [英] How to do SQL IN like query in hibernate search

查看:243
本文介绍了如何在休眠搜索中像查询一样执行SQL IN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个模拟场景是:

搜索内容包含成功"并且作者在所传递名称列表中的图书(可以是数千个).

Search for books whose content contains "success" AND author is in a list of passed names(could be thousands of).

我调查了过滤器: http://docs.jboss.org /hibernate/stable/search/reference/zh-CN/html_single/#query-filter

诸如休眠搜索之类的缝隙对此没有本机支持.

Seams like hibernate search has no native support of this.

对于此问题,推荐的方法是什么?我想我并不孤单.

What is recommended approach for this problem? I think I am not alone.

感谢任何输入.

推荐答案

如果在这里查看 http://lucene.apache.org/java/2_4_1/queryparsersyntax.html (在字段分组"末尾),您可以使用以下内容编写查询:

If you look here http://lucene.apache.org/java/2_4_1/queryparsersyntax.html (at the end "Field Grouping"), you can write a query with something like :

content:success AND author:("firstname" "secondname" "thirdname" ...)

这篇关于如何在休眠搜索中像查询一样执行SQL IN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆