Android的全文搜索和ListAdapter全文、Android、ListAdapter

2023-09-07 00:41:15 作者:回首已成往事

我已经有一个使用SQLite数据库和listadapter的应用程序。我想更新我的应用程序使用全文搜索功能,但是我在努力寻找答案的一个问题。基本上当我创建虚拟具有必要的_id列,该数据库将其转换为文本字段,它不再是一个自动增量主键。我怎么会去使用FTS3功能与listadapter?

I already have an application that uses the SQLite database and a listadapter. I am trying to update my application to use the Full Text Search capabilities but am struggling to find an answer to a problem. Basically when I create the virtual table with the necessary _id column, the database converts it to a text field and it is no longer an autoincrement primary key. How would I go about using the FTS3 capabilities with a listadapter?

推荐答案

在使用FTS3的SQLite忽略数据类型和约束。因此,所有列获得创建为文本。在地方_ID列,它创建一个文档ID也称为ROWID。为了获得适配器发挥好这个ID,你有别名它_id。

When using FTS3 sqlite ignores datatypes and constraints. So all columns get created as text. In place of the _ID column, it creates a docid also known as a rowid. In order to get the adapters to play nice with this id, you have to alias it to _id.

的sqlite的FTS文档检查第1.2节。 http://www.sqlite.org/fts3.html

Check section 1.2 of the Sqlite FTS docs. http://www.sqlite.org/fts3.html

也期待在SearchableDictionary一个别名的样本。

Also look in the SearchableDictionary for a sample of an alias.