更新时间:2023-02-01 07:46:00
你会在连接上调用 .enable_load_extension(True)
和 .load_extension('fts5')
对象,而不是在模块上.
You would call .enable_load_extension(True)
and .load_extension('fts5')
on the connection object, and not on the module.
但是,这应该不是必需的,因为 - 正如您所看到的 - 您的安装支持全文搜索.
However, this shouldn't be necessary since -- as you've seen -- your installation supports full-text search.
您可以通过以下方式进行测试以确保:
Here's a way you can test that out just to be sure:
import sqlite3
conn = sqlite3.connect(':memory:')
conn.execute("""create virtual table fts5test using fts5 (data);""")
conn.execute("""insert into fts5test (data)
values ('this is a test of full-text search');""")
conn.execute("""select * from fts5test where data match 'full';""").fetchall()
结果:
In [67]: conn.execute("""select * from fts5test where data match 'full';""").fetchall()
Out[67]: [('this is a test of full-text search',)]