Notes on the sourceware search engine, htdig

Htdig is used to provide the search engine on sourceware and gcc.gnu.org. It is a highly configurable program written in C/C++.

htdig is set up on sourceware with two entirely separate configurations/databases -- one for gcc.gnu.org and one for sourceware.cygnus.com. Hans-Peter Nilsson (hp@bitrange.com) has shown exceptional interest and knowledge in htdig, and maintains the search engine for the GCC project.

To leech off of H-P's contribution, as much as possible the htdig configuration files are shared (infra/htdig-conf/site.conf) and the parts that are specific to each site are in separate files in that same directory.

The configuration files are under CVS in the sourceware repo, but everything else htdig-related is in /sourceware/htdig. This is all on its own partition, and a large one at that. Everything is owned by userid htdigid.

htdig, in the process of rebuilding its database, needs about 3x the total size of the database. And its database is quite large. An example: If your database is 1GB, you'll need another 2GB to update the database.

Why 3x? The htupdate script does the rebuilding; it first makes a copy of the database files so that people can still search against the old database while the new database is being built. The original database plus the copy mean you've used 2x disk space. Another 1x is used to sort all of the entries after htupdate has finished checking all the web site.

Regenerating the htdig db

Sometimes the htdig databases need to be regenerated. Reasons vary from (mythical) system crashes during the normal update, or when mailing list archives move. How?

  1. In very rare circumstances, you might need to remove the files in /sourceware/htdig/sourceware/db. Those are the database files. Removing them makes the search engine stop working. Avoid this unless you're very short on disk or the search engine has already stopped working.
  2. As user htdigid, run touch /sourceware/htdig/sourceware/conf/INDEX-FROM-SCRATCH-NEXT-HTUPDATE-RUN.
  3. Now, you either wait until the cron job for the sourceware database picks it up (once a day), or you run the update script yourself. That can be done by cd /sourceware/htdig/sourceware; nohup nice ./bin/htupdate.sh&
    Don't run this at the same time as the nightly database updates. (Check htdigid's crontab.)
  4. Wait a long time (hours) for it to finish.
  5. Check the log generated for the latest update in /sourceware/htdig/sourceware/update-log.
  6. Test, for example by searching one or two affected mailing list archives and look for expected hits.

With ample disk space, I've seen htdig work without problems for months. With tight disk space, problems happen all the time. When I configured the sourceware system in summer 1999, I tried to make the htdig partition big enough for about two years of database growth.

Rebuilding htdig

To rebuild htdig, I used this configure line for htdig 3.1.5:

% ./configure  \
   --prefix=/sourceware/htdig/sourceware \
   --with-cgi-bin-dir=/sourceware/htdig/sourceware \
   --with-image-dir=/sourceware/htdig/sourceware/images \
   --with-search-dir=/sourceware/htdig/sourceware/search-samples

The 'htsearch' binary that you end up with after doing the make all install needs to be checked in to the cgi-bin directory of the sourceware.

See also the other htdig page.

Last modified 2000-12-27 by hp@bitrange.com.