Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

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

0.00/5 (No votes)
7 Jan 2011 1  
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:



HTML
http://www.example.com/UltimateSearchInclude/Admin/UltimateSearch.admin.aspx?cmd=IndexFull


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.


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 Files\Force5\USearchIndexTask.bat. You can save it wherever it makes the most sense in your hosting environment.


Once the batch file is saved, 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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here