简体   繁体   English

如何实现Ruby on Rails网站的搜索层?

[英]How to implement search layer for Ruby on Rails site?

We are implementing a product review site using Ruby on Rails. 我们正在使用Ruby on Rails实施产品评论网站。

Search is a core component of the user experience. 搜索是用户体验的核心组成部分。 We need to make searches fast and relevant. 我们需要快速且相关地进行搜索。

Should we use Lucene or another open source search layer? 我们应该使用Lucene还是其他开源搜索层? Should we use Google's search API and index against only our site? 我们应该使用Google的搜索API并仅针对我们的网站建立索引吗? Or should we develop proprietary search functionality? 还是应该开发专有的搜索功能?

Thanks! 谢谢!

I personally like Sphinx + UltraSphinx, but I'm sure there are an equal number of people who'd like Lucene or XXX. 我个人喜欢Sphinx + UltraSphinx,但是我敢肯定会有同样数量的人喜欢Lucene或XXX。 I'm afraid it depends on information not contained in your question. 恐怕这取决于您的问题中未包含的信息。 What are you searching? 您在搜寻什么? Does it have any form of taxonomy? 有任何形式的分类法吗? What terms are users going to be searching for? 用户将要搜索哪些术语?

Ultrasphinx + Sphinx takes about 10 minutes to get running so I'd suggest you give it a crack and see how you get on. Ultrasphinx + Sphinx大约需要10分钟才能开始运行,所以我建议您给它一个裂缝,看看如何继续。

Take a look at Solr. 看看Solr。 It's the fastest way to get up and running with a Lucene-powered search server. 这是使用Lucene驱动的搜索服务器启动和运行的最快方法。 It'll provide additional features like faceting and plumbing for document pre-processing when indexing. 它将为索引编制时的文档预处理提供诸如刻面和管道的其他功能。

Solr also provides a lot of room for scaling as your site grows via both sharding & replication. Solr还通过分片和复制为网站的扩展提供了很大的扩展空间。

There seems to be plenty of bindings for Ruby (I'm more of a PHP guy so I can comment on their usefulness). Ruby似乎有很多绑定(我是一个PHP专家,所以我可以评论一下它们的用处)。 Solr exposes a rich REST API you could leverage easily too. Solr公开了丰富的REST API,您也可以轻松利用它。

One thing to consider carefully with Solr is how to deal with search index updates. Solr需要仔细考虑的一件事是如何处理搜索索引更新。 Batch vs near real-time index updates may affect your strategy. 批处理与近乎实时的索引更新可能会影响您的策略。 You'll want to define your app's requirements in this regard ahead of time. 您将需要在这方面提前定义您的应用程序要求。

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

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