[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AJAX-search field in the docs (Proof-of-concept)

From: Reinhold Kainhofer
Subject: AJAX-search field in the docs (Proof-of-concept)
Date: Fri, 6 Mar 2009 18:28:43 +0100
User-agent: KMail/1.11.0 (Linux/2.6.27-11-generic; KDE/4.2.0; i686; ; )

Hash: SHA1

A few days ago, I decided it's finally time to learn what all that 
hype about AJAX is about. What would be a better guinea pig than 
trying to implement a seach box in our docs??? Well -- it turned out 
incredibly easy. Here it is:
(or any other manual there, like the NR or so)

As soon as you have typed in three letters or more, a request is 
sent to the server to search a pre-generated index file (created 
by our texi2html init file) for the entered string.
Currently, I'm building the search index from each manual's 
texinfo index and the search simply searches substrings of the 
index entries' titles.
The other issue is that currently the search index is stored as a 
pure text file and each request has to go through that file line by 
line and match the search text...
If JavaScript is disabled (so that AJAX won't work, either) or the files 
are viewed as static files on your harddisk (i.e. not over http, so
the AJAX call would fail for sure), no search box is shown.

What is missing in the texi2html init file is a check whether a manual 
really has an index. if it doesn't, the search box javascript should not 
be added to the html file at all.
The other problem is that the www-post script doesn't seem to install
the *.de.idx, *.ja.idx, *.fr.idx and *.es.idx files, while the *.en.idx files
are properly installed to Documentation/user/... So for now the search 
only works in the English docs. (Obviously, I'm also missing an error
check for the case where the index file can't be opened...)

I have tested the search box in Konqueror, Firefox and Opera. Since I 
don't have an IE, of course I also couldn't test it...

These search boxes are for now meant as a proof-of-concept 
implementation mainly. I haven't done any work on the corresponding
CSS styling to make the results look nicer.

If you are interested in the code, here's the patch for review:

It is also in git in my dev/kainhofer branch.

- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, address@hidden,
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 *, DVR: 0005886
 * LilyPond, Music typesetting,
Version: GnuPG v1.4.9 (GNU/Linux)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]