Writings from force 5 Basecamp

How-To: Use Wget to Automate the Karamasoft UltimateSearch Indexing Process for Your Website

Almost every modern website has a “search my site” module of some sort added to it. In this How-To I’m going to explain how to set up Karamasoft UltimateSearch to automatically rebuild its index on a repeating scheduled basis in a Microsoft Windows hosted environment.

First, you will need to obtain the UltimateSearch software from the Karamasoft site, found at: http://www.karamasoft.com/UltimateSearch/Features.aspx. Follow the directions provided to get the tool installed into your particular hosting environment. For this How-To I’m going to assume that you have a website www.example.com that you have the tool installed in. The process for starting the indexing process is as simple as accessing a particular webpage on your site and passing it a particular operation code in the query string. To start the full indexing process for our example site you would navigate to:


We want to be able to call this process via a script, so we will need something lightweight and easily used from within a scripting language. A perfect tool for this is the Open Source GNU Wget utility. From the GNU Wget site:

GNU Wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.

Download and install the GNU Wget utility. The Windows port can be downloaded from http://gnuwin32.sourceforge.net/packages/wget.htm. Download the setup program, follow the setup wizard, and install the utility to your server. After the installation process has completed, add the directory that you installed wget.exe into to the PATH environment variable.

Once you have UltimateSearch and Wget installed on your server you are now ready to set up the indexing job. In order to have the site be indexed based on a schedule, the admin link needs to be visited on a scheduled basis. In order to do this, we are going to use the Wget utility that we just downloaded in a batch file. That batch file will then be called as a scheduled task by Windows.

The batch file that I created is named USearchIndexTask.bat. In it is the following:

@echo off
wget -O - http://www.example.com/UltimateSearchInclude/Admin/UltimageSearch.admin.aspx?cmd=IndexIncremental > nul 2> nul

I have saved this file in c:Program FilesForce5USearchIndexTask.bat. You can save it where-ever it makes the most sense in your hosting environment.

Once the batch file is saved, then you need to create a scheduled task to run the batch file. In our environment I used Windows Task Scheduler to create the task. Use that tool to create a task to run the USearchIndexTask.bat file. Choose a frequency that makes sense for your environment, based on the quantity of changes for the site. If there are very few changes made on a daily bases, then having it run once a day at midnight is an appropriate setting.

Manually run the scheduled task to verify that it completed successfully, and then go get lunch. You are done!

To see more bright ideas from the Left and Right brains of Force5, check out the rest of our blog as well as our work!