休眠搜索与 spring-data-solr , spring-data-elasticsearch [英] Hibernate Search vs spring-data-solr , spring-data-elasticsearch

本文介绍了休眠搜索与 spring-data-solr , spring-data-elasticsearch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Spring Boot,Spring Data JPA (hibernate) Web 应用程序,想引入文本搜索功能.

I have a spring boot, Spring Data JPA (hibernate) web application and want to introduce text search feature.

我明白以下内容

  • hibernate search 或 spring-data-* 都可以集成到我的应用中

  • Both hibernate search or spring-data-* can be integrated into my app

Hibernate 搜索可以使用嵌入式 Lucene 或外部弹性搜索.

Hibernate search can work with embedded Lucene or external elastic search.

外接elasticsearch/solr各有各的好处,不过我没问题

External elastic search/ solr has its own benefits, but I am ok with

嵌入也开始了.

我的问题

  • 哪个库更易于开发和维护.
  • 我看到了 solr 与 elasticsearch 的许多优点和缺点,但需要优点和Hibernate 搜索与 spring-data-* 的缺点
  • 我找到了一个在现有应用中引入 Hibernate Search 的示例应用.但在 spring-data- 上没有任何内容,如何重新索引或触发spring-data中现有数据库数据的索引-

推荐答案

我显然是有偏见的,因为我是一个 Hibernate 开发人员,但我至少可以提供一些专注于 Hibernate Search 的元素.至于哪个更好",由你自己判断.

I'm obviously biased since I am a Hibernate developer, but I can at least provide some elements focused on Hibernate Search. As to which is "better", that's for you to judge.

主要区别在于 Hibernate Search 提供了 JPA 和您选择的索引(Lucene 或 Elasticsearch)之间的集成:

The main difference is that Hibernate Search provides integration between JPA and your index of choice (Lucene or Elasticsearch):

  • Hibernate Search 将根据您的 JPA 实体的更改自动在您的全文索引中添加/更新/删除文档(一旦您提交事务).
  • Hibernate Search 将允许您构建全文查询(全文世界),并将结果检索为托管实体(JPA 世界).

据我了解,Spring-Data-Elasticsearch 专注于访问 Elasticsearch,并且没有任何 JPA 集成.也就是说,你可以使用Spring-Data-JPA,也可以使用Spring-Data-Elasticsearch,但是它们之间不会相互通信.您将拥有两个独立的模型,您将分别对其进行更新和查询.

As far as I understand, Spring-Data-Elasticsearch is focused on accessing Elasticsearch and has no JPA integration whatsoever. That is to say, you can use Spring-Data-JPA, and you can use Spring-Data-Elasticsearch, but they won't communicate with each other. You will have two separate models, which you will update and query separately.

其他一些元素:

  • 如果您不需要分布式索引,Hibernate Search 可以在嵌入式 Lucene 模式下运行,无需所有 Elasticsearch 堆栈.它可能会更轻量级.
  • Hibernate Search 目前在自定义 Elasticsearch 映射或使用高级 Elasticsearch 功能时不太灵活,因为抽象层. 这不再适用现在 Hibernate Search 6 已经发布.
  • 过去曾开发过一个 Spring-Data-HibernateSearch 模块,但不再积极维护:https://github.com/snowdrop/spring-boot-hibernate-search-booster
  • If you don't need a distributed index, Hibernate Search can run in embedded Lucene mode, without all the Elasticsearch stack. It will probably be more lightweight.
  • Hibernate Search is currently not very flexible when it comes to customizing your Elasticsearch mapping or using advanced Elasticsearch features, because of the abstraction layer. That's no longer true now that Hibernate Search 6 has been released.
  • A Spring-Data-HibernateSearch module has been worked on in the past, but is no longer actively maintained: https://github.com/snowdrop/spring-boot-hibernate-search-booster

这篇关于休眠搜索与 spring-data-solr , spring-data-elasticsearch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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