任何第三方搜索引擎(全文搜索等)都可以与 InnoDB 表一起正常工作吗?

发布于 2024-11-27 18:04:48 字数 130 浏览 0 评论 0原文

我知道,InnoDB 表还不支持全文搜索。所以我想到使用第三方搜索引擎,如 solr、xapian 或 whoosh。这些第三方工具对 InnoDB 表的处理是否与对 MyIsam 表的处理一样好?我需要找到例如拼写建议和类似的字符串......

I know, that InnoDB tables do not support fulltext searches, yet. So I thought of using a third party search engine like solr, xapian or whoosh. Do those third party tools work equivalently fine with InnoDB tables as they work with MyIsam tables? I need to find e.g. spelling suggestions, and similar strings...

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

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

发布评论

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

评论(3

风铃鹿 2024-12-04 18:04:48

您可以使用 Solr/Lucene 对数据库数据进行全文搜索。由于我的 MySQL 数据库对于快速全文搜索来说太大了,我决定将 mysql 和 Solr/lucene 结合起来。

重要的是要知道,Solr/Lucene 不是 MySQL 插件。因此,您将无法使用典型的 MySQL SQL 语句来搜索全文索引。由应用程序发起的全文搜索应首先将请求发送到第 3 方全文索引 (Solr),后者返回相关文档的主键。第二步是使用带有来自 Solr 结果集的相应主键的 where 子句对 MySQL innoDB 运行 SQL 语句。
该解决方案在我的案例中效果非常好,并且比典型的 MySQL Myisam 全文搜索快得多(更好)。

作为替代方案,您不仅可以在 solr 中索引数据。您还可以另外将数据存储在 solr 中。在这种情况下,solr 能够返回全文。因此,您不需要从数据库获取数据,如上面的示例所示。

这些第三方工具在 InnoDB 表上的工作效果是否与在 MyIsam 表上的工作效果相同?

绝对地。 Solr 有一个 DataImportHandler。然后,您定义一条 SQL 语句来获取您想要在 solr 中索引的数据,例如:select * from MyTable;
但请记住:目前(据我所知)没有可用的 MySQL solr 插件。 Solr和MySQL的配合应该由应用程序来处理。

You could use Solr/Lucene to do the fulltext-search over your DB data. Since my MySQL DB is to big for an fast fulltext-search, i decided to combine mysql and Solr/lucene.

It's important to know, that Solr/Lucene is not an MySQL Plugin. So you will not be able to search the fulltext-index by using typical MySQL SQL-Statements. An fulltext-search, initiated by the application, should be first send the request to the 3rd party fulltext-index (Solr), which returns the primary keys of the related documents. Second step is to run an SQL statement against your MySQL innoDB with an where clause with the corresponding primary keys from the Solr result set.
That solution works in my case very well and much, much faster (and better) than an typical MySQL Myisam fulltext-search.

As an alternative you could not only index the data in solr. You also could store the data in solr additionally. In that case, solr is able to return the full text. So you don't need get the data form the database, as in the example above.

Do those third party tools work equivalently fine with InnoDB tables as they work with MyIsam tables?

Absolutely. Solr has an DataImportHandler. Ther you define an SQL statement in order to get the data you like to index in solr, like: select * from MyTable;
But keep in mind: right now (as far as I know) ther is no MySQL solr plugin available. The cooperation of Solr and MySQL should be handled by the application.

她比我温柔 2024-12-04 18:04:48

第三方全文搜索引擎通常复制 MySQL 查询返回的数据,并使用它来填充其搜索索引。 MyISAM 和 InnoDB 数据源在这方面没有区别。

我做了一个演讲MySQL 中的实用全文搜索 几年前。你可能会觉得很有趣。

Third-party fulltext search engines typically copy data returned by a MySQL query, and use it to populate their search index. There's no difference between MyISAM and InnoDB data sources in this respect.

I gave a presentation Practical Full-Text Search in MySQL a few years ago. You might find it interesting.

救赎№ 2024-12-04 18:04:48

Sphinx 支持自己的索引,只需通过发出查询及时从 MySQL 获取数据。

它甚至不知道底层的表结构,只要查询运行并返回结果,Sphinx 就可以了。

其他第三方引擎的工作方式类似。

Sphinx supports its own index and just takes data from MySQL on a timely basis by issuing a query.

It is not even aware of the underlying table structure and as long as the query runs and returns the results, it's OK for Sphinx.

Other third party engines work in a similar way.

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