Solr vs Hibernate Search - Which to choose and When?

前端 未结 6 1125
广开言路
广开言路 2020-12-24 03:20

We are building an ecommerce application. We are using JAVA stack with Hibernate and Spring Framework. As with all ecommerce application, we need to build search capability

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-24 03:41

    In addition to what has been said, when in a clustered environment:

    Hibernate-search:

    Cons:

    • Requires a master/slave combination which isn't always feasible, specially when your build/deployment process doesn't distinguish among the nodes (same war for all nodes).
    • The indexes are hosted in the same server/process as the application running Hibernate, so you have one index per application node. This is sometimes overkill.
    • It isn't real-time search, unless the load balancer uses session stickiness.

    Pros:

    • Zero to little configuration. Just drop the jar in the classpath.
    • The bridge between Hibernate and Lucene is very straight forward. Just annotate the Entities and voilá!

    Solr/SolrCloud:

    • It is decoupled of the application it self.
    • Not real-time search, just as hibernate-search.
    • Requires restart to change the schema.
    • SolrCloud isn't exactly the easiest framework to configure.
    • No straight forward Hibernate bridge. You have to code your own Hibernate listener and bind them to post-[insert|delete|update] events (or find an open source one)

    ElasticSearch

    • Servers are independent of the application, just like solr.
    • It is by far the easiest to configure in a cluster/cloud.
    • It is real-time
    • No straight forward Hibernate bridge, as well. (es-hibernate-connector on GitHub)

    Personally I prefer ElasticSearch when running in the cloud.

提交回复
热议问题