Search Highlighter

This application allows webmasters to highlight search results on their web pages. When a user performs a search using Google, AltaVista or other search engine, then clicks on a link to a website which has the search highlighter installed, all matching search terms in the page are highlighted in yellow. The page will also automatically scroll down to the first match. This makes it much easier for the user to find what they're looking for. Try this example, search for "Neil Fraser" in your favourite search engine. Choose my site, and note the highlighting (if you've recently been to my homepage, your cache may serve an unhighlighted version of the page).

Features

Known Bugs

Installation

  1. Make sure that your copy of Apache is version 2.0.48 or later and has mod_ext_filter installed.
  2. Add the following to your Apache config.
      SetEnvIf Referer "[?&]q=." do_highlight # Google, AltaVista, MSN, AllTheWeb, etc.
      SetEnvIf Referer "[?&]query=." do_highlight # Lycos, AOL, HotBot, Netscape, etc.
      ExtFilterDefine highlighter mode=output enableenv=do_highlight intype=text/html \
        cmd="/usr/bin/python /home/yourname/highlighter.py"
      SetOutputFilter highlighter
  3. Download highlighter.py and place it in the location specified above.

Problems installing or want something special? Read the advanced installation guide.

Alternatives

An entirely different strategy for providing search highlighting is to do it on the client's side using JavaScript. See Lao-Tzu's highlighter for a good implementation. Works for any browser with JavaScript 1.2

Another method is to use a custom Apache module. Adorn Software wrote one called mod_suru which is pretty much identical to my version, except that it costs money (mine is free) and only works on Apache 1.3.x (mine only works for Apache 2.x).

-------------------------------------
Last modified: 7 August 2003