SQLite全文搜索目录
我想知道 fts(3/4) 对于 SQLite 是否可以实现以下功能。 我使用 fts3 创建了一个包含一些数据的表。
例如,如果我搜索 e*,我会得到以 ^e 开头的所有内容 但我也可以在索引/目录中搜索以 e 开头的特定单词吗?
这样我只能得到该词的结果,例如;艾略特,埃洛,呃。
I wonder if the following is possible with fts(3/4) for SQLite.
I created a table with some data using fts3.
If i for example search for e* i get everything that starts with ^e
But can i also search the index/catalog for the specific words that starts with e?
So that i only get the results of that words back like; elliot, elo,eehh.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://www.sqlite.org/fts3.html#section_3
将返回文档包含以“lin”开头的单词。您只想要匹配的单词,而不想要上下文?也许“片段”功能会对您有所帮助。您可能会发现感兴趣的线程:
http://www.mail-archive.com/sqlite-users@sqlite.org/msg49345.html" mail-archive.com/[电子邮件受保护]/msg49345.html
http://www.sqlite.org/fts3.html#section_3
Will return the docs that contain a word starting with "lin". You only want the words that match, not the context? Maybe the "snippets" feature will help you. And you may find this thread of interest:
http://www.mail-archive.com/[email protected]/msg49345.html
FTS 引擎通过
offsets
虚拟函数提供该信息。正如文档所说:
如何提取该信息取决于您以及如何将代码与 SQLite 集成。
The FTS engine provides that information via the
offsets
virtual function.As the documentation says:
How to extract that information is up to you and how you integrate your code with SQLite.
代码片段函数的文档关于其第六个参数相当模糊,因为该算法使用了最佳-score 方法来查找片段。
尽管如此,在我的申请中,我得到了我正在寻找的请求的原始条款的清晰摘录:
它可能对您的情况有所帮助;这个数据库内解决方案帮助了我,因为我不想提取位于数据库外部的代码中的术语。如果您正在搜索单个单词(MATCH 查询中没有空格、OR、..),它会起作用
the documentation of the snippet function is rather vague regarding its 6th parameter because the algorithm uses a best-score approach to find the snippet.
Nevertheless in my application i get a clean extract of the original terms I am looking for with the request :
It may help in your case ; this in-database solution helped me because i didn't want to extract the terms in code located outside of the db. It works if you are searching for single words (no space, OR, .. in the MATCH query)