mardi 1 septembre 2015

Sqlite Full Text Search - Receive RowID/DocID by selecting a Record?

I want to use sqlite full text search in a Xamarin PCL Project.

I've created the table:

base.e_Connection.CreateCommand("CREATE VIRTUAL TABLE IF NOT EXISTS ApplicationFTS USING fts4(ApplicationTxt string, tokenize=porter)");

And fill it with inserts as following:

cmdText = "insert into ApplicationFTS (docid, ApplicationTxt) values (?, ?)";
var command = base.e_Connection.CreateCommand(cmdText, 31231, "Example Text");
command.ExecuteNonQuery();

When I select the record by rowID or with the MATCH clause I get the content of the record correctly. But I want to read out the rowID and it's always returns the ID 0.

[Table("dbApplicationFTS")]
public class ExTable
{
   public int rowid { get; set; }
   public string ApplicationTxt { get; set; }
}

var dbItems = base.e_Connection.Query<ExTable>("select rowid, * FROM ApplicationAreaFTS WHERE Appl MATCH 'Example Text';");

Why the rowIDs are always 0 for each record when I read them out but when I select the record by the rowID itself I receive the correct record?

In a sqlite console example it works as it should.

Thanks for your help in advance!

Aucun commentaire:

Enregistrer un commentaire