Sorry for the late reply. There's a test in TestCases.cs in the source code distribution which shows an example of using FTS2. I'll post it here:
using
(DbCommand cmd = cnn.CreateCommand()){
cmd.CommandText = "CREATE VIRTUAL TABLE FullText USING FTS2(name, ingredients);";
cmd.ExecuteNonQuery();
string[] names = { "broccoli stew", "pumpkin stew", "broccoli pie", "pumpkin pie" };
string[] ingredients = { "broccoli peppers cheese tomatoes", "pumpkin onions garlic celery", "broccoli cheese onions flour", "pumpkin sugar flour butter" };
int n;
cmd.CommandText = "insert into FullText (name, ingredients) values (@name, @ingredient);";
DbParameter name = cmd.CreateParameter();
DbParameter ingredient = cmd.CreateParameter();
name.ParameterName = "@name";
ingredient.ParameterName = "@ingredient";
cmd.Parameters.Add(name);
cmd.Parameters.Add(ingredient);
for (n = 0; n < names.Length; n++)
{
name.Value = names[n];
ingredient.Value = ingredients[n];
cmd.ExecuteNonQuery();
}
cmd.CommandText = "select rowid, name, ingredients from FullText where name match 'pie';";
int[] rowids = { 3, 4 };
n = 0;
using (DbDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (reader.GetInt64(0) != rowids[n++])
throw new ArgumentException("Unexpected rowid returned");
if (n > rowids.Length) throw new ArgumentException("Too many rows returned");
}
}
}
The idea is that you create a full-text index on some text, and use the rowid or some other id as a foreign key in some other table you have.
Robert