Android Full Text Search and ListAdapter

一曲冷凌霜 提交于 2019-12-09 03:26:24

问题


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?


回答1:


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.

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

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



来源:https://stackoverflow.com/questions/5011405/android-full-text-search-and-listadapter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!