Ian Vink
Ian Vink

Reputation: 68810

MonoTouch + SQLite + SQLite.Net ORM: Full Text Indexing

I use the SQLite.NET ORM wrapper for SQLite on MonoTouch to create a database based on business objects. Works fine.

I wish to run the SQLite full text indexing command so that a full text virtual table is created. However the SQLite.Net ORM doesn't support that directly. Is there a way to create an index using other commands on MonoTouch?

The SQL to create a Full Text Index is just:

CREATE VIRTUAL TABLE "Term" USING FTS3 (
"Id" INTEGER PRIMARY KEY,
"Word" integer,
"Definition" TEXT 
);

insert into Term(Id,Word,Definition) 
  Select Id,Word,Definition from SomeOtherTable;

drop table SomeOtherTable;

Upvotes: 4

Views: 799

Answers (1)

Maxim Korobov
Maxim Korobov

Reputation: 2572

I believe that SQLite.NET does not supports creating full text indexes, but supports creating ordinary indexes.

Anyway, you could try to execute any custom SQL-code via:

<YOUR_SUBCLASS_OF_SQLiteConnection>.Execute(<YOUR_SQL_CODE>);

Example:

public class LocalDatabase: SQLiteConnection
{
    ...
    public LocalDatabase (string path) : base(path)
    {
        ...
        Execute("CREATE VIRTUAL TABLE \"MyTable\" USING FTS3 ...");
        ...
    }       
    ...
}

Upvotes: 1

Related Questions