Elastic Search 与 Sunspot 的功能比较

发布于 2025-01-02 20:38:49 字数 406 浏览 5 评论 0原文

Couden 找不到任何与 sunspot (Solr) 和 Elastic Search (Lucene) 相关的比较问题 这两个搜索引擎的优缺点是什么?

我看到了其他 VS 问题,以便更好地比较 2 个宝石,因此希望这能让新手(像我一样)更好地了解这两个引擎。我已经研究过太阳黑子,但有一些问题。所以我搜索了

Couden't find any compare questions related to sunspot (Solr) to Elastic Search (Lucene)
What would be the pro's and con's on both search engines?

I saw other VS questions to get a better inside in the comparisment of 2 gems so hope this is allowed to get a better insight in the both engines for newbies ( like me ). I have looked at sunspot already but have some issues with it. So I searched

vs

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

要走就滚别墨迹 2025-01-09 20:38:49

我开始从事一个需要在 Ruby 中进行全文搜索的项目,所以很自然地我从 Solr + Sunspot 开始,但我无法让它工作。将它们连接起来是一件很痛苦的事情,然后尝试弄清楚文档索引是否正确,找出运行时类路径,以便我可以添加其他分析器/标记生成器类,编辑 config.xml/schema.xml 等。Solr numDocs 清楚说它收到并索引它们,但我无法得到任何查询结果。几天后我就放弃了,这真是一个配置地狱。

ElasticSearch + Tire 的启动和运行非常轻松,我在一小时内就开始工作了。

Lucene 只是一个 Java 搜索库,因此 Solr 被开发为一个完整的服务搜索应用程序,但 Solr 仍然具有典型 Java Web 应用程序的所有陷阱:过于复杂的 XML 配置、模式繁重、需要用于索引的 XML 文档、需要Java servlet 容器(Jetty 或 Tomcat),对我来说已经成为太多的故障点。

ElasticSearch 也基于 Lucene,它有一个内置的 servlet 容器,因此只需像守护进程一样运行,使用非常直接的 JSON + REST API,因此它非常适合测试,并且更自然地适合 Ruby。它是无模式的,它对我来说甚至不需要编辑配置文件就可以工作。一切都很顺利。

我真正需要的是中文搜索,ElasticSearch 已经将 Luecene 的 SmartChineseAnalyzer 打包为插件。如果您需要这种级别的定制,不确定定制分析器/标记器链会有多困难。 ElasticSearch 和 Tire 的文档都是一流的。

Tire(ElasticSearch 的 Ruby 库)

https://github.com/karmi/tire

你可以尝试一下在演示中,它将安装一个rails searchapp,下载ElasticSearch二进制文件并运行它,然后自动启动Webrick。

$ rails new searchapp -m https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb

在我的系统上,它抱怨没有 Javascript 引擎(Rails 3.2?默认不再包含thereubyracer gem),所以我必须:

$ wget https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb
$ nano rails-application-template.rb

在文件中添加 gem 'therubyracer' (查找 gem 'tire' 和 gem 'will_paginate') ,然后...

$ rails new searchapp -m rails-application-template.rb

为了开发我自己的应用程序,我只是下载了 ElasticSearch tarball 并使用 -f 开关在前台运行(这样我可以通过 Ctrl-C 轻松停止它)

$ bin/elasticsearch -f

您可以安装 eleasticsearch-head 插件来获取 Web 管理界面

https://github.com/mobz/elasticsearch-head

我还发现:如果您有一对多关系模型,Tire 不会在搜索结果中为您解析它们,它只会返回一个平面集合。你的 has_many 和 Belongs_to 关系只是集合中的对象 ID,而不是完整的对象。

I started working on a project that needed full text search in Ruby so naturally I started with Solr + Sunspot, but I couldn't get it to work. It was a pain just the get them connected, then tried to figure out if the document indexed correctly, figure out the runtime classpath so I can add additional analyzer/tokenizer classes, editing config.xml/schema.xml, etc. Solr numDocs clearly said it received and indexed them but I couldn't get any query results. I just gave up after a couple days, it was kind of a configuration hell.

ElasticSearch + Tire was a breezy to get it up and running, I got it working in an hour.

Lucene is just a Java search library, hence Solr was developed to be a full service search app, but Solr still have all the trapping of a typical Java webapp: overly complicated XML configurations, schema-heavy, expect XML docs for indexing, requires a Java servlet container (Jetty or Tomcat), which just become too many points of failure for me.

ElasticSearch is based on Lucene too, it has a built-in servlet container so just run like a daemon, use a very straight forward JSON + REST API so it's great for testing and a more natural fit for Ruby. It's schemaless and it worked for me without even editing a config file. Everything worked beautifully.

What I really needed was Chinese search and ElasticSearch already packaged Luecene's SmartChineseAnalyzer as a plugin. Not sure how difficult it will be to customize the analyzer/tokenizer chain if you need that level of customization. Docmentation for ElasticSearch and Tire are both top-notch.

Tire (Ruby library for ElasticSearch)

https://github.com/karmi/tire

You can try out the demo, it'll install a rails searchapp, download the ElasticSearch binary and run it, then start Webrick automatically.

$ rails new searchapp -m https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb

On my system it complained about not having a Javascript engine (Rails 3.2? no longer include thereubyracer gem by default), so I had to:

$ wget https://raw.github.com/karmi/tire/master/examples/rails-application-template.rb
$ nano rails-application-template.rb

add gem 'therubyracer' in the file (look for gem 'tire' and gem 'will_paginate'), then...

$ rails new searchapp -m rails-application-template.rb

For developing my own app, I just downladed the ElasticSearch tarball and run in the foreground with the -f switch (so I can easily stop it by Ctrl-C)

$ bin/elasticsearch -f

You can install the eleasticsearch-head plugin to get a web admin interface

https://github.com/mobz/elasticsearch-head

Also something I found out: if you have one-to-many relationship models, Tire won't resolve them for you in the search results, it just returns a flat collection. Your has_many and belongs_to relationships will just be object ids in the collection rather than full objects.

一抹苦笑 2025-01-09 20:38:49

我认为你应该搜索 Solr 和 Elastic Search 之间的比较。
事实上sunspot是基于Solr的,而Solr和elasticsearch都是基于Lucene的。它们是两个具有相似目标的不同项目,都构建在 Lucene 之上。

这里有两个比较:

ElasticSearch、Sphinx、Lucene、Solr ,夏皮安。哪个适合哪种用法?

http://www.findbestopensource。 com/article-detail/solr-vs-elasticsearch

I think you should search for a comparison between Solr and elastic search.
In fact sunspot is based on Solr, and both Solr and elastic search are based on Lucene. They are two different projects with similar goals, both built on top of Lucene.

Here are two comparisons:

ElasticSearch, Sphinx, Lucene, Solr, Xapian. Which fits for which usage?

http://www.findbestopensource.com/article-detail/solr-vs-elasticsearch

空袭的梦i 2025-01-09 20:38:49

以下是有关该主题的最完整的最新帖子:http://solr-vs-elasticsearch。 com/

截至 2018 年 5 月我的建议

如果功能的网格太长,这里有一些简单的指南
以上没有帮助。

如果满足以下任一条件,请选择 Solr...

  • 您的团队主要由 Java 程序员组成
  • 您已经在堆栈中使用 ZooKeeper
  • 您已经在堆栈中使用 Java
  • 您正在构建一个具有特定且细致入微的相关性要求的搜索应用程序
  • 您正在构建电子商务、职位或产品搜索引擎
  • 搜索是产品和用户体验的核心部分,组织要求搜索成为核心优势

如果满足以下任一条件,请选择 Elasticsearch...

  • 您的团队主要由 Ruby/PHP/Python/全栈程序员组成(并且您的应用程序没有具体且细致入微的相关性)
    要求)
  • 您以 JSON 为生
  • 您已使用 Kibana/ELK 来管理日志
  • 您的应用需要大量分析

如果有疑问...

我开发过的每一个严肃的搜索应用程序都需要
深度定制搜索工作流程和相关性调整,
在撰写本文时,这在
Elasticsearch 没有重大黑客攻击。如果有疑问,请转到 Solr。

Here is the most complete up-to-date post on the topic: http://solr-vs-elasticsearch.com/

My recommendations as of May 2018

Here are some simple guidelines if the crazy long grid of features
above did not help.

Choose Solr if any of the following are true...

  • Your team consists mainly of Java programmers
  • You're already using ZooKeeper in your stack
  • You're already using Java in your stack
  • You are building a search application that has specific and nuanced relevancy requirements
  • You are building an ecommerce, job, or product search engine
  • Search is a central part of your product and user experience and there is the organizational mandate for search to be a core strength

Choose Elasticsearch if any of the following are true...

  • Your team consists mainly of Ruby/PHP/Python/full stack programmers (and your application does not have specific and nuanced relevancy
    requirements)
  • You live and breathe JSON
  • You already use Kibana/ELK for managing your logs
  • Your application is analytics-heavy

If in doubt...

Every serious search application I have worked on has required
in-depth customization of the search workflow and relevancy tweaks,
and at the time of writing, this is simply not possible in
Elasticsearch without major hacking. If in doubt, go Solr.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文