Search Highlighter

Advanced Installation Guide

The three-step installation on the main search highlighter page should work fine. But there are exceptions. This page walks you through the installation in greater detail.

Apache 2.0.48
The Search Highlighter requires Apache 2. You can find out what web server you are running by using the "What's that site running?" feature at Netcraft. If you don't have Apache 2.x, you're out of luck. Time to upgrade.

If you have version 2.0.48 or later, you're fine. Earlier versions of Apache 2 require a one-line patch to be installed in the file modules/filters/mod_ext_filter.c. This corrects bug 20944.

mod_ext_filter
Make sure that your copy of Apache has mod_ext_filter installed. It comes with Apache, but may or may not be compiled in or switched on. Check for this line in your httpd.conf file and make sure it isn't commented out:
  LoadModule ext_filter_module modules/mod_ext_filter.so
Not sure if mod_ext_filter is working? Try adding the following to your httpd.conf file:
  ExtFilterDefine testfilter mode=output cmd="/bin/cat -n"
  SetOutputFilter testfilter

After you restart Apache, all webpages should have numbers all over them. You'll want to quickly remove this line and restart Apache.

highlighter.py
The next step is to download a copy of the highlighter program. You can drop it anywhere. Run it from a command prompt (python highlighter.py) to make sure it's happy. It should print out a debug line or two, then sit there. Press Ctrl-C to interrupt it.

If you have an old version of Python, it may ask for the HTMLParser.py and markupbase.py libraries. Just download them and place them next to highlighter.py

Highlight the entire server
Insert the following into your httpd.conf file:
  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

You can find out where python lives by typing which python. Obviously you'd change /home/yourname/highlighter.py to be the path where you downloaded the highlighter program. Restart Apache, and every page should have highlighting on it when linked from a search engine.

Selective highlighting
To only highlight a single account, place the above code inside the appropriate virtualhost directive. Or if you want to add it to many (but not all) accounts, place the first four lines in the main section of httpd.conf, then just add the SetOutputFilter line into the virtualhosts that need it. You can also use any of Apache's rich control directives (such as <Location>, <Directory>, <Files>) to restrict what does and doesn't get highlighted.

Still having problems?
Email me.

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