开发者

How to do SQL IN like query in hibernate search

A simulating scenario is:

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

I looked into filter: http://docs.jboss.org/hibernate/stable/search/reference/en-US/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.

Thanks for any inputs.


Let me post my current solution.

Get the search results with minimal projections for the keywords, and loop through the results to get only matching ones from the IN list.

I am not using filter.

Open to other alternatives once convinced.


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" ...)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜