使用innoDb实现搜索功能的最佳方法 [英] Best way to implement search functionality using innoDb
问题描述
如果索引在大型产品表中使用innodb,我需要实现类似全文搜索的功能,MyISAM由于缺少事务和关系支持而不是选项。
我可以通过几种方法来实现这一点,插件,存储过程,带键的搜索表以及以MyIsam格式复制的索引。
过去你是如何实现这一点的,这是最好的方式(包括我没有提到过的),为什么?
这个插件听起来很贵,存储过程听起来很慢,而搜索表听起来像是和管理员的噩梦。
喜欢听你的意见。
一种可能性可能是使用外部的(独立于数据库)全文引擎,例如 Lucene (如果您使用PHP,您可能还想看看 Zend_Search_Lucene
) 有很多(一些免费的,一些昂贵的,一些开源的,一些专有的);但他们通常会允许你比MySQL全文允许的更远 - 并且它不会被集成到数据库内部(这可能是好的:例如,你可以索引文档,或者是坏的:您无法轻松地将这些结果加入到您的SQL查询结果中)
使用此类引擎的优势在于全文搜索真是他们的工作;他们应该做得很好(并且对于用户倾向于输入的内容是聪明的)。
缺点是你必须有另一个引擎;这意味着更多的工作,更多的配置和更多的开发,因为你不能让他们插入你的数据库。
I need to implement something like a full text search on a couple if index's in a large products table, using innodb, MyISAM is not an option due to its lack of transactions and relationship support.
I can think of a couple of ways of doing this, plugin, stored procedure, search table with keys and copied index's in MyIsam format.
How have you acheived this in the past, which is the best way (including any I have not mentioned) and why?
The plugin sounds expensive, the stored procedure sounds slow, and the search table sounds like and admin nightmare.
Love to hear your views.
A possibility might be to use an external (independant of the Database) full-text engine, like, for instance, Lucene (if you are using PHP, you might also want to take a look at Zend_Search_Lucene
)
There are plenty of those (some free, some costly, some open source, and some proprietary) ; but they'll generally allow you to go farther than what MySQL full-text allows -- and it won't be integrated inside the database (which might be good : you can index documents, for instance -- or bad : you can't join those results with one of your SQL query results that easily)
The advantage of using such an engine is that full-text search is really their job ; and they're supposed to do it well (and be "intelligent" about what users tend to input).
Drawback is you must have another engine ; which means more work, more configuration, and more development, as you can't just have them "plugged-in" in you DB.
这篇关于使用innoDb实现搜索功能的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!