I'm using Xamarin on Visual Studio 2015 with this SQLite Plugin: https://github.com/praeclarum/sqlite-net
Here's my algorithm and explanation of the problem:
public class MyModel
{
[PrimaryKey, AutoIncrement]
public int _id { get; set; }
public string bla { get; set; }
public string ble { get; set; }
public MyModel()
{
}
}
Then:
conn.CreateTable<MyModel>(CreateFlags.FullTextSearch4);
var item = new MyModel();
var insertCount = conn.Insert(item);
The code above returns 1 for the insertCount and item._id is always updated as it should. But when I later query the table, the _id is always 0 for all rows. For instance:
var tokens = mySearchBar.Text;
string query = "SELECT * FROM MyModel WHERE MyModel MATCH '" + tokens + "'";
List<MyModel> result = conn.Query<MyModel>(query);
This seems to work but feels not right, it doesn't seem to be returning all possible result. But the main problem is that it's returning 0 for every _id. And I can check it out with:
var bli = conn.Query<MyModel>("SELECT * FROM MyModel");
All rows _id are 0. Any idea why and how can I fix it?
I have no problems if I create the table without the fts4 flag. But then I can't do the MATCH search.
Thanks