如何在启用 FTS3 的情况下将二进制数据存储在 SQLite 表中?

发布于 2024-10-02 07:24:45 字数 171 浏览 3 评论 0原文

我正在将应用程序从使用普通 SQLite 数据库转换为启用全文搜索的数据库。它有几个 BLOB 列,用于存储数字签名等内容,显然不需要索引。我读到其他人通过将所有非文本数据移动到一个单独的非 FTS3 表中来解决此问题,必要时将其与 FTS3 表进行内部连接,但这是一个非常不优雅的解决方案。有没有办法简单地从索引中排除某些列?

I'm transitioning an application from using a normal SQLite database to one with full text search enabled. It has several BLOB columns that store things like digital signatures, which obviously do not need to be indexed. I've read that other people solve this by moving all non-TEXT data to a separate, non-FTS3 table that they inner join with the FTS3 table when necessary, but this is a very inelegant solution. Is there no way to simply exclude certain columns from indexing?

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

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

发布评论

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

评论(2

挽心 2024-10-09 07:24:45

这并不不优雅。 SQL 是关系型的,连接是生活中很自然的一部分。认为它们“不优雅”是导致典型的糟糕数据库设计的原因。

您已确定拥有两种不同类型的数据 - 经常需要搜索的文本和不需要搜索的 blob。将它们存储在两个不同的表中绝对没有任何错误或不雅观。

It's not inelegant. SQL is relational, joins are a natural part of life. Thinking they're "inelegant" is what leads to stereotypically poor database designs.

You've determined you have two different kinds of data -- text you often need to search, and blobs you do not. There is absolutely nothing wrong or inelegant about storing these in two different tables.

昔梦 2024-10-09 07:24:45

您可以通过创建连接视图来减少麻烦,然后您可以在其中进行选择。您仍然可以对源自 fts 表的列使用 MATCH,并且不必每次想要查询时都执行该连接。

You can make it less of a hassle by creating a view of the join that you can then select over. You can still use MATCH on the columns that originated in the fts table, and you don't have to do that join every time you want to query.

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