开发者

Full text search in iOS application bundle files

How would I go about doing a full text search across a bunch of html files in an iOS application bundle? I need to have a lot of web content available offline and I need to be able to d开发者_运维百科o a full text search across all of it. I feel like storing that content in a database will get a little bulky and slow things down significantly.

Thoughts?

-- Thanks, Brandon


Do keep in mind that, even though it's a mobile device, the iPhone does have a fairly fast processor. All you're doing [said tongue-in-cheek] is searching text. These devices are built for video, music, and images.

In order of increasing amounts of coding on your part, you can:

  • Use a 3rd-party library (the only one I found is Locayta)
  • Port a non-Objective C search library (such as Lucene)
  • Store your HTML files in a database, and do a SQL search for any search text. Without a bunch of extra coding, this will really only work easily with exact matching on a single search term.
  • Manually load each file into the app and search the text using NSString's rangeOfString. Add features at will.
  • Build your own search engine, built off (at least) an index of terms. Start by trimming stop words, stem if you feel the need, decide if you want document relevance or not and possibly pursue vector space algorithms. Adding in autocorrect is probably beyond your app's focus, but nonetheless building your own text search engine would be a fast (run-time) way of providing multi-word search and a big bullet on your resume.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜