How to use full-text search FTS in SQLite
This article mainly introduces how to use full-text search FTS in SQLite, which is very detailed and has certain reference value. Friends who are interested must finish reading it!
Using full-text search FTS in SQLite
SQLite supports full-text search. Through the full-text search function, it is convenient for users to find it quickly. In iOS, SQLite frameworks such as GRDB and FMDB all support FTS technologies, such as FTS3, FTS4 and so on. Each framework has different syntax, but operates in the same way. When using it, it is necessary to create a corresponding virtual table according to the target (recordset or table). SQLite will read the corresponding data, segment words, and form a B-tree. In order to store the B-tree, three real tables are built. All three tables are prefixed with the name of the virtual table and are prefixed with _ content, _ segments, and _ segdir, respectively. The following three tables are described in turn:
Tables with the suffix _ content hold the real data contents. Each record consists of two columns, docid and docment. Where docid is the record number. Document saves the specific content. Each document is a B-tree.
The table with the suffix _ segments holds the non-root node of the B-tree. Each record includes two columns, blockid and block.
The table with the suffix _ segdir holds only the root node of the B-tree.
The above is all the contents of the article "how to use full-text search FTS in SQLite". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!