August 29, 2004 3:54 PM
Client side scripts do have their advantages1. Ever since
my first exposure to Javascript, I've always thought about writing a
"Search this Site" script. Well, scavenging through the net and using
EmacsWiki, I finally did write one a few years back.
Search using Javascript? Ugh. Yeah, the disadvantages are obvious. But
since an online search of this site is required rarely2 and
considering the fact that anybody who is desperate enough to search
through my site probably deserves to download a huge3 js
file, I
present JavascriptSearch. It works with the word list4 dumped using
emacs-wiki
and some document.write
calls. All in all, it works and
is better than searching through the pages manually though it is
word list based and cannot provide contextual results.
Initially, I had thought of making the word to search for as the key while searching. That is, for every word, there would be a corresponding list of pages where it appeared. The size of the list is large since I only have a few pages. The Javascript version has a list of words for each page. It's not a long term solution anyway.
[1] CGI enabled free and decent hosts are rare these days.
[2] Google does index this site, you know.
[3] Proportional to the number of blog entries.
[4] emacs-wiki-count-words.el was a side product of that effort.