Lucene 与 MySQL MyISAM
现在,我们使用lucene来进行搜索。但是相比lucene,我们是否可以使用Mysql MyISAM来代替呢?
使用它们有什么好处?
Now, we are using lucene to do search. However, compared with lucene, could we use Mysql MyISAM instead.
What are benefits to use them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 Lucene,您将能够(仅)创建全文索引,与全文查询相比,该索引的性能会更好。请记住,它只是全文搜索,而不是功能齐全的 DBMS。
另一个搜索引擎是 Xapian,或包装到 应用程序。我没有这方面的个人经验,但据我所知,通过大量信息进行搜索是完美的。
With the Lucene you will be able to create (only) a Full-Text index who will perform better with full-text queries compared. Keep in mind that it is only a Full-text search and not a fully featured DBMS.
Another search engine is Xapian, or wrapped into an application. I don't have personal experience with it, but from what I have heard it is perfect to search trough huge amounts of information.
使用 MyIsam 可能是个坏主意,因为您无法在索引中建立外键关系。搜索文本字段时它也会比 Lucene 慢。
Probably a bad idea to use MyIsam as you can't do foreign key relations within your index. It will also be slower than Lucene for searching text fields.
MyISAM 全文搜索不是最可配置的。某些更改需要重新编译 MySQL。
http://dev.mysql.com/doc/refman /5.5/en/fulltext-fine-tuning.html
它也有一定的限制,特别是如果你想全文显示多个字段(你不能在全文中说“字段 A 有 foo 或字段 B 有 bar”)查询——您需要 SQL OR)。另一个限制是自然语言搜索的固定 50% 阈值< /a>.
我猜测 Lucene 的 FullText 速度要快得多,因为 Lucene 是为了执行这些搜索而构建的。如果您的数据已经在 MySQL 中,您可能想尝试 MyISAM。如果您只想搜索,请使用 Lucene。 Lucene 还比 MySQL FullText 更容易扩展。
MyISAM FullText search is not the most configurable. Some changes require recompiling MySQL.
http://dev.mysql.com/doc/refman/5.5/en/fulltext-fine-tuning.html
It is also somewhat limited, especially if you want to FullText multiple fields (you can't say "field A has foo or field B has bar" within the fulltext query--you need a SQL OR). Another limitation is the fixed 50% threshold for natural language searches.
I would guess that Lucene's FullText is much faster, since Lucene was built to perform these searches. If your data is already in MySQL, you may want to try MyISAM. If you just want to search, go with Lucene. Lucene also will scale much easier than MySQL FullText.