Monday, April 15, 2013

Core Data and SQLite FTS

Apple has yet to bring full text searching to Core Data, or even Search Kit to iOS.

Justin Driscoll:

I wrote a simple sample app in order to see what kind of performance gain I might see from using a separate full text index in SQLite. The app loads 1682 text files from textfiles.com (where else?), that’s about 42mb of plain text, into both Core Data model objects and an SQLite database. I then timed how long it took to find a single word using both a full text query and a core data fetch request. For one query running on the main thread on slowest device I have (a 4th gen. iPod touch) the Core Data fetch took 9.34 seconds while the SQLite query only took 1.48 seconds.

Simon Wolf:

It appears that the version of SQLite that ships with iOS 6 and OS X 10.8 actually have FTS enabled, are compiled to be threadsafe and have the more advanced searching enabled by default. Therefore it is not necessary to include your own custom build of SQLite in your application.

Comments RSS · Twitter

Leave a Comment