Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top