tags:

views:

535

answers:

2

Is there an Iphone SDK API to search resource files?

I have a set of html file resources that I'd like the user to be able to search in, but I want to avoid reading the files into memory and searching them one by one.

Is there any API that can help me do this?

+1  A: 

No, you'll have to read the files in to search them. There's nothing like "Spotlight" on the phone.

August
The problem with that is i have a lot of html, about 5Mb I'm worried about the search performance. But I guess I'm just going to have to do it and see what the performance is like
hhafez
I would argue that if you have that much data, you're better off using a SQLite database instead of flat files. Maybe even do some sort of content index in the database that's searchable along with a pointer to the actual HTML file.
August
I've been looking for an excuse to play with SQLite I thik I'll give a try
hhafez
A: 

I would suggest you using SQLite FTS3 extension for full text search through your documents. It has quite good capabilities for it. But you will need to strip HTML tags first so it can index only your text and don't bother with tags

Kostiantyn Sokolinskyi