Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tools for searching full text in iOS bundle

Sorry for the generalized question...I have been hunting for a long time and haven't found anything I can use or easily adapt yet. I'd really appreciate any pointers!

I'm building a reference app that will contain several textbooks in plain-text format. I want the user to be able to perform a search, and get a table back with a list of results. I have a working prototype, but the search logic that I wrote isn't all that smart and it's been hell trying to make it better.

This is obviously a fairly common problem so I'm looking for a tool that I could adapt to the task. So far I've found Lucene (http://vafer.org/blog/20090107014544/) and Locayta (http://www.locayta.com/iOS-search-engine/locayta-search-mobile/)

Lucene appears to have been last updated for iOS 2...I don't even know if I'll be able to rework it myself. Maybe.

Locayta would probably work great, but a commercial license is $1,000 and I may not soon recoup that with this app, as it's a niche market.

Thanks!

like image 392
Reid Avatar asked Apr 10 '13 18:04

Reid


2 Answers

We stumbled upon the same predicament where I work, and have yet to decide on a solution. Locayta seems promising, but barring that, I've looked into SQLite's FTS3/FTS4 as well.

The only issue seemed the lack of a way to match partial words. It's easy to search for fields that contain whole words (eg. "paper" matches "printer paper", "paper punch", and "sketch paper"), or words that start with something (eg. "bi*" matches "binder", and "bicycle"), but there's no built in way to match a suffix.

If you don't require that functionality, FTS3/FTS4 might work.

I see you mentioned in the follow-up that your SQLite didn't recognize FTS3(), and I had the same issue at first. Apparently it's not bundled into the iOS version by default, instead you have to download the SQLite3 amalgamation, and include it in the project manually. As found at is FTS available in the iOS build of SQLite?

Also note, the SQLITE_ENABLE_FTS3 variable is not enabled by default, you just have to add it to the configuration as detailed at http://www.sqlite.org/fts3.html#section_2

Hope this helps.

like image 128
Luca Avatar answered Nov 15 '22 23:11

Luca


If you can translate plain C code to iOS Objective-C, then Apache Lucy (a loose "C" port of Lucene) might be worth a look.

like image 38
Mark Leighton Fisher Avatar answered Nov 16 '22 00:11

Mark Leighton Fisher