Search file content on iphone - iphone

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?

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

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

Related

Failed to display UIWebView to display docx/xlsx file with SFUZipEndOfCentralDirectoryError error with custom URL

We are writing some program to display documents on iOS. I think that there are a lot of confusion on the web about what type of documents which iOS UIWebView could display. Generally people refer to Technical Q&A QA1630 Using UIWebView to display select document types to see that all the MS office 07+ files (such as docx, xlsx, pptx) could not be displayed, however actually that is not what we see from testing. Actually we are able to display docx/xlsx/pptx document at UIWebView either loading from a remote URL, local file or in memory (loadData, here the baseURL can not be nil on simulator, see this link). Of course We are testing on latest version of iOS on iPhone simulator, it might be that the support was not at older iOS. At this point, We don't know that yet. If you know, please let me know.
However right now, We have one issue to display document at UIWebView by using custom URL for security reason. I did the custom URL by following the code here: protecting iOS resource. We could display xls, doc, ppt, pdf file, but not docx/xlsx/pptx, We got some error like this:
EXCEPTION SFUZipEndOfCentralDirectoryError: Could not find the end of central directory record
We tried to debug and could not figure what's to do here. Do you see similar error here? Could anyone shed some lights on this? Thanks very much.
It looks like the document you're trying to open might be corrupt. docx, xlsx, and pptx files are actually zip files containing a bunch of XML documents and other data. Check if you are able to uncompress the file on your computer by renaming it to .zip and then unzipping.

Pdf Reader+iphone

i want to make PDF reader app in phone.
where i have to implement search functionality.
in which i have to take the text of one page of .pdf file and have to do search functionality.
Is anyone had done it.
Please give me the sample code.
Thanks in advance
Editing the question.....
I had done how to search the key word,but i is working on .pdf file of one single page only.But not able to do how i have to search the word in multiple page.
Example:-
If i am having the .pdf file of multiple page.And now i want to implement the search functionality.Then how can i do it.
Please help me
Yes someone did it before. I used this kit also and it is great to search pages and highlight the result. It's PDFKitten by KurtCode (on Github).

Retrieving updated files from server to replace files on documents folder of an iPhone

Im new to iPhone programming and wanted to see how people have solved this problem:
Ive created my app which will ship with certain pLists and .png files in the main bundle. However, what I want to do is when the app starts up, Id like it to check my server to see if there are updated versions of the files in the documents folder available. If so Id like the app to download those files.
I was wondering if someone can point me to some resources on how to do this? Ive searched online but haven't come up with good hits.
Whats the google key-word for searching this topic anyways?
Thanks a lot
you can use NSUrlRequest to download the files, to move them to the correct place you can use NSFileManager, if you look at the apple docs for both these classes there should be sample code explaining how to copy/save a file from NSData, and also how to download it.
I don't have any example resources of how to do exactly this, though I would probably do something along the lines of onAppLoad checking to see if the content of the application that you want to keep updated is the most recent, and if not, download it.
As for keywords to search I would try something along the lines of "Automatic App Content Updating/Verification" and throw in "iOS/iPhone/iPad" or some similar combination.
I'll do some more poking around and shoot you a comment notification if I find anything worthwhile, and then edit my post with it.

search string in html files in iphone

I am very new to iphone.In my iphone application there are about hundred html files.I would like to search a string that the user enters in all these hundred html files and return the files that contain the string specified.
Is there any way that i could attain this in iphone?
Please forward your valuable suggestions.
Thanks in advance:)
Searching directly from the filesystem may be possible, but will be tremendously processor intensive. I recommend that you add the searchable contents of the files into a Sqlite database, or use a full-text search library like Lucene, or both.

Is it possible to search files of particular extension in the entire device?

In my application, i am trying to find all files of particular extension (like .pdf, .txt, etc) that are stored in the device (either downloaded or transferred from system) and want to list them in table View. Is it possible to do so and if it is then can i associate file of specific extension to get it open in supporting application (any third party plug-ins).I went through numerous documentation but couldn't find the solution. Also how can i index files of these extension for fast search.
Any help is appreciated. Thanks.
No, it's not possible. You app can't access files of other apps directly.