Tag Archives: Search

Rank sql(ite) text search results

When searching for text snippets in sql databases you might want to rank the results according to „how good did it match“. And: the ranking shouldn’t make the query slower. Let’s take a simple example using the LIKE operator. (I know, FTS does a better job, but let’s stick to like for now). Assume the […]

Vortrag: Index Suche mit CoreData und SQLite

Gestern gab’s einen Mini-Vortrag von mir bei den CocoaHeads München: CoreData (iOS) ist nur mit Tricks dazu zu bringen den Index bei Textsuche zu benutzen, SQLite Full Text Search (FTS) ist der Hammer. Die Folien dazu.

iPhone: SQLite Fulltext Index

Most blogposts I found on this topic don’t explain it from the beginning, so it took me quite a while to figure out how simple and powerful the sqlite fulltext search API (FTS3) actually is. get the sqlite3 amalgamation sources (v3.6.22) and just unpack it into your iPhone project – sqlite3 as shipped on the […]

Binary Search NSArray

Though CFArray comes with binary search capability, NSArray does not – at least not within the iPhone SDK. The indexOfObject:inSortedRange:options:usingComparator: can’t be found. Plus the CFArrayBSearchValues doesn’t tell you whether the key actually is part of the list or not. That’s what the Java JDK does, so let’s implement some category methods -(NSInteger)binarySearch:(id)key; -(NSInteger)binarySearch:(id)key usingSelector:(SEL)comparator; […]

CocoaTouch, CoreData and binary String Search

The query optimiser for NSPredicate queries ontop CoreData/SQLite on the iPhone is a bit rudimentary (cough) and so I had to optimise myself to get binary-search enabled quick results: