简体   繁体   English

如何使用Hibernate中的Example类在数据库中搜索相似实体

[英]how to search similar entities in database using Example class from hibernate

i know that there are an Hibernate class called Example that we can use to get similar entities in order to do a search, but is it possible that this class permit to get entities searching in a generic way. 我知道有一个名为Example的Hibernate类,我们可以用来获取相似的实体以进行搜索,但是该类是否有可能允许以通用方式获取实体。

I explain, I build an example entity having a property called name with value = "myname", is Hibernate capable to return an entity which has property having value = "mname" ? 我解释一下,我建立了一个示例实体,该实体具有名为name的属性,其值为value =“ myname”,Hibernate是否能够返回其属性具有value =“ mname”的实体?

Yes that's possible but to enable text-level similarity you need a Lucene index to speed-up the query, as it would otherwise be extremely inefficient to run on a relational database. 是的,这是可能的,但是要启用文本级别的相似性,您需要一个Lucene索引来加快查询速度,否则在关系数据库上运行效率极低。

This is provided by Hibernate Search , the extension of Hibernate to integrate with Lucene and manage the indexes transparently. 这是由Hibernate Search提供的,它是Hibernate的扩展,可以与Lucene集成并透明地管理索引。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM