Monday, December 27, 2004

Web Search Without the Web

This is another way how you could go about supporting quick searches on your webpages.

Basically, you build a dictionary of keywords mapped to webpages and supply that in the Javascript of your webpage. On the client-side you lookup the query word in the dictionary to get the list of webpages containing that word and display the results. Take an intersection of the results, if the query is composed of multiple keywords.

You can reduce the size of your dictionary data-structure, by mapping filenames to file-identifiers (fileIds), and mapping keywords to fileIds, instead of the actual filenames.

The advantage of this approach suggested by Micah is that the search is fast, while the disadvantage is that the client would need to pay for downloading the dictionary. The author claims that for 4461 distinct words, the size of the Javascript was around 160KB.