`

The Full-Text Search (FTS) in SQLite

 
阅读更多

http://www.sqlite.org/fts3.html

 

FTS3 and FTS4 are an SQLite virtual table modules that allows users to perform full-text searches on a set of documents. The most common (and effective) way to describe full-text searches is "what Google, Yahoo and Altavista do with documents placed on the World Wide Web". Users input a term, or series of terms, perhaps connected by a binary operator or grouped together into a phrase, and the full-text query system finds the set of documents that best matches those terms considering the operators and groupings the user has specified. This article describes the deployment and usage of FTS3 and FTS4.

FTS1 and FTS2 are obsolete full-text search modules for SQLite. There are known issues with these older modules and their use should be avoided. Portions of the original FTS3 code were contributed to the SQLite project by Scott Hess of Google . It is now developed and maintained as part of SQLite.

 

The FTS3 and FTS4 extension modules allows users to create special tables with a built-in full-text index (hereafter "FTS tables"). The full-text index allows the user to efficiently query the database for all rows that contain one or more words (hereafter "tokens"), even if the table contains many large documents.

For example, if each of the 517430 documents in the "Enron E-Mail Dataset " is inserted into both an FTS table and an ordinary SQLite table created using the following SQL script:

CREATE VIRTUAL TABLE enrondata1 USING fts3(content TEXT);     /* FTS3 table */
CREATE TABLE enrondata2(content TEXT);                        /* Ordinary table */

Then either of the two queries below may be executed to find the number of documents in the database that contain the word "linux" (351). Using one desktop PC hardware configuration, the query on the FTS3 table returns in approximately 0.03 seconds, versus 22.5 for querying the ordinary table.

SELECT count(*) FROM enrondata1 WHERE content MATCH 'linux';  /* 0.03 seconds */
SELECT count(*) FROM enrondata2 WHERE content LIKE '%linux%'; /* 22.5 seconds */
分享到:
评论

相关推荐

    sqlite3 mmicu icu fts cipher数据库代码及示例

    FTS(Full-Text Search)是SQLite3的一个扩展,用于实现全文搜索引擎。它允许用户通过自然语言查询来查找数据库中的记录,而不仅仅是基于精确匹配的关键词。在SQLite3中,FTS提供了FTS3、FTS4、FTS5等版本,不断优化...

    sqlite3 mmicu fts cipher sdk

    "mmicu fts cipher sdk"是针对SQLite3的一个扩展,集成了全文搜索引擎(FTS,Full-Text Search)和加密支持(cipher),使得开发者能够在SQLite3数据库中实现高级的文本搜索和数据安全性。 FTS是SQLite3的一个扩展...

    DISQLite3 Pro v5.10.0 for D4-XE10 SQLite 轻量级 组件

    Full Text Search (FTS) with customizable tokenizer, prefix matching, and optional word stemming for 15 languages. Database AES encryption with SHA256 key generator. Db.pas is not required, which ...

    sqlite3用于c#开发源码

    - 支持全文搜索:SQLite可以通过FTS(Full-Text Search)模块实现文本检索。 - 空间数据支持:SQLite提供Spatialite扩展,支持地理空间数据类型和函数。 - 数据库加密:SQLite可以使用AES加密,保护数据库内容的...

    sqlite-source-3_6_18.zip

    2. **fts3.c**:全文搜索(Full-Text Search,FTS)功能的实现,提供了对文本内容的高效搜索。FTS3是SQLite的一个扩展模块,支持模糊查询和索引文本列。 3. **vdbe.c**:Virtual Database Engine(VDBE)是SQLite的...

    SQLite工具集

    7. SQLite FTS (Full-Text Search):SQLite内置的全文搜索引擎,提供强大的文本搜索能力,可以方便地在大量文本数据中查找信息。 8. SQLite amalgamation:SQLite的源代码集合,开发者可以将其直接集成到自己的应用...

    sqlite3.6.15管理器,可加密码带ODBC。

    2. sqlite3_mod_fts3.dll:这是一个全文搜索(Full-Text Search,FTS)模块,使得在SQLite数据库中进行复杂文本搜索成为可能。 3. sqlite3_mod_blobtoxy.dll:可能是用于处理BLOB(Binary Large Object)数据类型的...

    sqlite-source-3_6_20 C语言 源代码

    2. **fts3.c**: 这是SQLite的全文搜索(Full-Text Search,FTS)扩展模块的一部分,提供了对文本数据进行复杂查询的能力。FTS3是SQLite的早期版本的全文搜索实现,它支持索引和搜索多语言文本。 3. **vdbe.c**: ...

    SQLite3加密方法总结

    FTS5(Full-Text Search 5)是SQLite的全文搜索模块,它允许对文本进行快速的模糊查找。FTS5同样支持加密,但请注意,这仅限于全文索引,并不加密实际的数据表。因此,如果你需要全面的数据库加密,还需要结合其他...

    Python库 | datasette_configure_fts-1.0-py3-none-any.whl

    而`datasette_configure_fts`则是Datasette的一个扩展,它专注于增强Datasette的全文搜索能力,使得用户可以更加灵活地配置和使用SQLite的FTS(Full-Text Search)功能。 首先,我们要了解什么是SQLite的FTS。...

    sqlite-doc-3071600.zip

    12. **全文本搜索**:SQLite内置了FTS(Full-Text Search)模块,支持高效的全文索引和查询,使得在大量文本数据中查找信息变得简单。 通过阅读"sqlite-doc-3071600"中的文档,开发者可以深入理解SQLite的工作原理...

    sqlite3综合资料(包涵linux和windows)可编译调试

    - FTS(Full-Text Search):内置的全文搜索引擎。 学习SQLite3不仅需要掌握SQL基础,还需理解其特定的特性和优化技巧。压缩包中的"sqlite综合"可能包含教程、示例代码、API文档等资源,可以帮助你深入理解和使用...

    sqlite 3420000 完全手册

    6. **扩展功能**:介绍虚拟表(如 FTS,Full-Text Search)和其他高级特性,如用户自定义函数、触发器、存储过程等,使 SQLite 具有更强的灵活性和定制能力。 7. **错误处理与诊断**:讲解如何理解和处理 SQLite 在...

    DISQLite3 v5.12.0 Professional for Delphi 10 Seattle & 10.1 Berlin

    Full Text Search (FTS) with customizable tokenizer, prefix matching, and optional word stemming for 15 languages. Database AES encryption with SHA256 key generator. Db.pas is not required, which ...

    Android系统中基于FTS的全文检索器

    在Android系统中,全文检索(Full-Text Search,简称FTS)是一种强大的功能,它允许用户快速、高效地搜索大量文本数据。FTS是数据库管理系统中的一个重要特性,它能够对数据库中的文本字段进行索引,从而提高搜索...

    Sqlite For Windows 数据库安装文件

    4. **fts(Full-Text Search)**:SQLite提供内置的全文搜索功能,允许用户在文本字段中执行复杂的搜索操作。 5. **列式存储**:虽然SQLite主要以行式存储数据,但在某些版本中已经开始支持列式存储,这在处理大...

    search-for-kirby:真正找到您想要的

    5. **full-text-search** - 全文搜索功能,使用户能够搜索文本中的所有内容,而不仅仅是关键词。 6. **fts5** - FTS5是SQLite数据库中的一个特性,用于实现全文搜索引擎,可能被该插件利用来支持在本地存储的数据上...

    DISQLite3 5.5.0 for D4-XE6

    Full Text Search (FTS) with customizable tokenizer, prefix matching, and optional word stemming for 15 languages. Database AES encryption with SHA256 key generator. Db.pas is not required, which ...

    SqliteDev2.8.7.rar

    其中,FTS(Full-Text Search)模块是SQLite的一个扩展,使得在数据库中进行文本检索变得更加高效。 6. **Sqlite.hgl**:这可能是SqliteDev的图形界面资源文件,用于构建和展示用户界面。 7. **settings.ini**:这...

    heinzelnisse-sqlite:用于编码的heinzelliste.txt的简单转换器,返回一个SQLite数据库

    描述中提到,“Heinzelnisse SQLite转换器”利用了Full-Text Search 4 (FTS4)功能,这是SQLite的一个扩展,提供了强大的全文搜索引擎。FTS4使得用户可以对文本数据进行自然语言搜索,极大地提升了查询效率和用户体验...

Global site tag (gtag.js) - Google Analytics