使用 mongomapper、sunspot/solr 或 sphinx 高级搜索 mongodb?
我正在使用 mongodb 和 mongomapper 来存储我的所有产品。每个产品属于多个类别,这些类别具有多个级别,即类别、子类别等。 每个产品都有许多搜索字段,这些搜索字段是产品中嵌入的文档。
所有这些都有效,我现在想向应用程序添加搜索。
搜索系统需要文本搜索:多重、动态、分面搜索,包括最小/最大范围搜索。
我一直在研究 sunspot gem,但在开发中设置它很困难,更不用说尝试在生产中运行它了!我也看过狮身人面像。
但我想知道仅使用 mongomapper / mongodb 是否足够快且是最好的方法,因为它是一个相当复杂的搜索系统?
任何有关这方面的帮助/建议/经验/教程和示例将不胜感激。
非常感谢,
瑞克
I have am using mongodb with mongomapper to store all my products. Each product belongs to multiple categories that have many levels i.e. category, sub category etc.
Each product has many search fields that are embedded documents in product.
All this is working and I now want to add search to the app.
The search system needs text search: multiple, dynamic, faceted search including min/max range search.
I have been looking into sunspot gem but having difficulty setting it up on dev let alone trying to run it in production! And I have also looked at sphinx.
But I am wondering if using just mongomapper / mongodb will be quick enough and the best way, as its quite a complex search system ?
Any help / suggestions / experiences / tutorials and examples on this would be most appreciated.
Thanks a lot,
Rick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我参与过一次非常大的 Sphinx 支持的搜索,我认为它可怕。如果您想要通过非常简单的全文搜索进行任何操作,则很难配置。另一方面,Solr\Lucene 非常灵活,并且设置和运行起来非常容易。
我没有将 Solr 与 MongoDB 结合使用来通过所有额外的功能(例如构面等)来支持全文搜索。根据您配置 Solr 的方式,您甚至可能不需要访问 MongoDB 来获取数据。或者,您可以告诉 Solr 对字段进行索引,但不存储它们,而是只存储与 MongoDB 内部数据相对应的 ObjectId。
如果您的搜索确实是一个复杂的搜索系统,我强烈建议您不要使用 MongoDB 进行搜索,而使用 Solr。一个重要原因是 MongoDb 没有全文功能 - 相反,它具有正则表达式匹配。正则表达式匹配效果很好,但仅在某些情况下使用索引。
I've been involved with a very large Sphinx powered search and I think its awful. Very difficult to configure if you want anything past a very simple full-text search. Solr\Lucene, on the other hand, is incredibly flexible and was unbelievably easier to setup and get running.
I am not using Solr in conjunction with MongoDB to power full text search with all the extra goodies, like facets, etc. Depending on how you configure Solr, you may not need to even hit your MongoDB for data. Or, you may tell Solr to index fields, but not to store them and instead you just store the ObjectId's that correspond to data inside of MongoDB.
If your search truly is a complex search system, I very strongly recommend that you do not use MongoDB for search and go with Solr. One big reason is that MongoDb doesnt have a full text feature - instead, it has regular expression matches. The Regex matches work wonderfully but will only use indexes in certain cases.