Note that there are some explanatory texts on larger screens.

plurals
  1. POHas apple now enabled FTS in the standard/built-in sqlite library?
    text
    copied!<p>I want to use FTS in my iOS project. Through some answers to questions here on SO (like <a href="https://stackoverflow.com/questions/5954433/is-fts-available-in-the-ios-build-of-sqlite">this</a>) and other sources (like <a href="http://longweekendmobile.com/2010/06/16/sqlite-full-text-search-for-iphone-ipadyour-own-sqlite-for-iphone-and-ipad/" rel="nofollow noreferrer">this</a>), i understood that i will have to roll out my own built of sqlite3 on iOS, thus replacing the dependency to default libsqlite3.dylib. </p> <p>But when i directly run the query (in a new project, with just the standard 'libsqlite3.dylib' linked and no custom sqlite build) :</p> <pre><code>"SELECT rowid FROM pages WHERE textcontent MATCH 'jim';" </code></pre> <p>on a table 'pages' created by using query :</p> <pre><code>"CREATE VIRTUAL TABLE pages USING fts3(textcontent TEXT)", </code></pre> <p>I dont get any errors, instead, i get the correct result (rowid of the rows in which the word 'jim' exists) as if the FTS is enabled by defalt in the built-in iOS sqlite library .</p> <p>So, is this the case? Has apple now enabled FTS in the standard/built-in sqlite library? Or there is something that i am missing here?</p> <p>Thanks.</p> <p>PS. I am using FMDB in my project as an sqlite wrapper and here is the code that i use to test the above. </p> <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES); NSString *documentsDir = [paths objectAtIndex:0]; NSString *dbDocumentsPath = [documentsDir stringByAppendingPathComponent:@"1.db"]; FMDatabase *db = [FMDatabase databaseWithPath:dbDocumentsPath]; if (![db open]) NSLog(@"Could not open db."); if([db executeUpdate:@"CREATE VIRTUAL TABLE pages USING fts3(textcontent TEXT)"]) NSLog(@"Virtual Table Created"); if([db executeUpdate:@"INSERT INTO pages(textcontent) VALUES ('Jack')"]) NSLog(@"First Insert Done"); if([db executeUpdate:@"INSERT INTO pages(textcontent) VALUES ('jim is jam')"]) NSLog(@"Second Insert Done"); FMResultSet* resultSet1 = [db executeQuery:@"SELECT rowid FROM pages WHERE textcontent MATCH 'jim';"]; while([resultSet1 next]) NSLog(@"%@",[resultSet1 objectForColumnName:@"rowid"]); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload