【发布时间】:2021-12-27 00:59:23
【问题描述】:
我有一个 SQLite3 表:
CREATE TABLE "test" (
"title" TEXT,
"shortdesc" TEXT,
"longdesc" TEXT,
"id" TEXT,
PRIMARY KEY("id")
);
我在里面插入任何东西:
INSERT INTO test (id, title, shortdesc, longdesc) VALUES ("abc", "hello world", "this is a hello world", "a nice hello world article about hello worlds")
然后我创建一个 FTS5 虚拟表:
CREATE VIRTUAL TABLE IF NOT EXISTS test_fts USING fts5 (
id,
title,
shortdesc,
longdesc,
content=test
);
所以我检查虚拟表中的数据:
一切似乎都很好...现在我尝试使用MATCH 来查找文章:
SELECT * FROM test_fts WHERE test_fts MATCH 'hello'
...我没有得到任何结果。显然我展示的这个数据库只是一个例子,实际数据库也会发生同样的事情。我在不同的计算机(和不同的客户端)上尝试过,我还检查了 FTS5 是否已启用并在其中编译,PRAGMA compile_options 和 ENABLE_FTS5 存在,这意味着它已启用。 FTS3 和 4 也会发生同样的情况。
那么我错过了什么? SQLite 版本是 3.36.0。
【问题讨论】:
标签: sqlite full-text-search fts3 fts4 fts5