I'm having some difficulty determining what search solution to use in my new iPhone application. The data structure I have is a hierarchy plist that describes a table of contents that link to an HTML file stored locally. I only have two levels in the TOC (Chapter and Section) so it nicely fits into a UITableView with headers and cells. The main content is the text in the HTML files. I want to have a separate view that would allow someone to search for words and have it return relevant documents (In this case sections as descri开发者_如何学Pythonbed in the plist). All this data is hard coded in the application (it doesn't change) so hard coding an compiled index into the application is acceptable. There are a few ideas I had. But want opinions on the best and easiest way to implement a search algorithm on an iPhone.
== Reverse word indexing ==
I scan the HTML documents for relevant words and store them in a flat file (plist) with an array of references to those files per word.
Problem is this doesn't help with more than one word or document relevancy.
== Vector Space Search ==
This seems like a great idea but the logistics on how to implement such a thing seems quite complex especially for a simplistic iPhone application that displays a table of contents and a set of pages. Any ideas on how to implement such a thing?
What recommendations are out there for an iPhone application?
Lucene is decent, and probably easier than writing it yourself.
精彩评论