One of my favorite TV shows is “This Old House.” OK, I admit it: I’m boring. But I enjoy building things and watching the process take shape. First, you start with the foundation; then, you create the framework; and, finally, you do the finish work. The same analogy applies to Web sites. The first step is to come up with a marketing plan for what kind of site you want. The second step is to build the site. Finally, you are ready for the finish work.
In my view, the finish work is what separates the good Web sites from the not-so- good. With the release of V4R4 of OS/400, IBM provided a great tool for taking your Web site to the next level: the AS/400 Webserver Search Engine. This tool allows you to build a native AS/400 search engine for your site.
I am amazed by the fact that many “professionally” designed Web sites that I run across on a daily basis are extremely hard to navigate. I use the Web to find information quickly. I don’t want to wade through 15 pages to find what I am looking for. This is where the Webserver Search Engine can work to your advantage.
Building the Foundation
Obviously, the first thing you need to do is build a Web site. A search engine isn’t much good without pages to search. One major point to consider, however, is where to put your pages. The Webserver Search Engine does not work with the QDLS file system or Network File System (NFS). (I built an entire site in a folder in the QDLS directory before I discovered this!) Any other AS/400 Integrated File System (AS/400 IFS) directory or QSYS.LIB can be used to store your pages. Because most HTML documents are developed on PCs, however, the AS/400 IFS is probably a better choice than QSYS.LIB. Also, it is important to know that this search engine does not “deep crawl.” What this means is that it does not follow links, so it is important to keep all of the documents that you want to index in one directory. (Subdirectories within the directory you use are indexed.) IBM recommends creating a folder in the root (/) directory of the AS/400 IFS in order to achieve the best performance possible.
The second thing that you want to keep in mind when designing your pages is your “keywords.” When you create your HTML pages, it is important to use the keywords and phrases that you want to be found as many times as possible in both the meta tags and the text of the document itself. The more you use keywords and phrases, the higher relevancy they will have on subsequent searches.
Let’s Take a Minute to Talk About Shop Safety
Another consideration is graphics files such as GIFs and JPGs. These should be stored in a folder different from the one containing your HTML documents. The Webserver Search Engine’s results can be adversely affected if they are indexed. For example, if you have a graphic named as400.gif on every page, the value of the search term “as400” will be lowered.
In the next section, I will cover how to create a search index. It is important to know that this can be a resource-intensive project, depending on the size of your Web site. If you have thousands of pages, you will probably want to create your indexes during off- peak hours to avoid performance degradation.
Time to Pound Some Nails
Once you have a site built, it’s time to start configuring the search engine. The good news is that this is really easy to do. You can do it directly from your browser by simply connecting to http://yourserver.com:2001. You may have to use the STRTCPSVR SERVER(*ADMIN) HTTPSVR(*ADMIN) command to start the server. This connects you to port number 2001 on your AS/400, which is where the HTTP administration server is located. Once you have logged in, select HTTP Server for AS/400/Configuration and Administration/Search Administration. At this point, you are ready to build your search index. To do this, first click on the Create search index link. Figure 1 shows the form that is presented. You will input the following data:
• A name for the index (I called mine “HELPDESK.”)
• The directory where it will be created (I used the default directory.)
• An optional description for the index
Press the Apply button, and you will be prompted to enter the name of the directory that you wish to index (where your Web pages are). Once you enter the directory name, press the Apply button again, and your search index should be created. The newly created index name should appear in the frame on the left-hand side of your screen. It is important to note that you need to re-create indexes from time to time in order to keep the searches current. Until the index is re-created, newly added pages or updated pages will not be reflected in your search results.
On to the Fun Stuff
Now that the grunt work of creating the search index has been completed, it’s time to create the HTML that will be used to do actual searches. Figure 2 contains code that can be used to perform your searches. This is a simple HTML form that you can customize to perform searches that are as basic or complex as you desire. When the Submit button is clicked, a Net.Data macro is executed and returns the search results. The macro that is executed in this example, sample_search.ndm, is provided by IBM. This macro can be customized to return results in any way you desire.
There are 12 elements to the form, some that are required and some that aren’t. Here is a breakdown of what these elements are and how to use them:
• frmIndexName (required)—This is the name of the index that you created earlier.
• frmDir (required)—This is the path name of the directory where your index is located.
• frmMapFile (required)—This file is generated automatically when you generate your search index.
• frmQueryType—This specifies whether the query is “simple” or “advanced.” A simple query searches only for the words listed, while an advanced query allows the use of Boolean operators such as “and,” “or,” and “not.”
• frmStartNum—This option tells the search engine which document to begin with when returning results.
• frmPreference—This specifies whether or not wildcards are allowed.
• frmCaseSensitive—This allows for matching of uppercase or lowercase letters.
• frmStemming—This is a nice feature that enables the search engine to return “fuzzy” matches. If, for example, you do a search for “computerized,” the search engine will return results for “computer,” “computing,” etc.
• frmLogical—This field specifies which logical operator should be used when searching for multiple words.
• frmPrecision—This field regards how “exact” a search will be. A value of 100 means that only exact matches are to be returned. Lowering the precision will return more results.
• frmSearchString—This is a listing of the words that you want to search for.
• frmMaxCount—This is used to indicate the number of matches to return at one time.
Although I have coded most of the form elements as hidden, you can use any or all of them as input fields on your Web page. This provides the flexibility for making searches as simple or complex as you want.
Putting the Fruits of Your Labor to Work
Once you have loaded the search page onto your AS/400, you can begin doing searches. However, in order to effectively use the Webserver Search Engine’s capabilities, you must understand exactly how it performs searches.
The Webserver Search Engine uses the index that you created earlier to search for matches. It uses the index because it is much quicker to search an index than it is to search the actual documents. The index also contains rankings of the documents. An understanding of ranking is important, as it will help you control which documents are ranked highly. Webserver uses the following three criteria to determine the relevancy of a particular document:
• The number of times the terms searched for appear in a particular document
• The position of the search terms in the document (The higher they appear on the page, the greater weight they are given.)
• The number of times the search term appears in the index (“The,” for example, would rank very low, while a less common word such as “palindrome” would rank higher.)
In order to have a page rank highly, you must follow these three criteria. This is easy to do when you control all of the content on your site. It is, however, much more difficult for the big search engines such as Yahoo! If Yahoo!’s rules were this easy to figure out, it would get 10,000 submissions a day using the same technique and the searches would become worthless.
There are a few other tricks to increasing rankings in the Webserver Search Engine that IBM doesn’t mention. The page name, for example, will highly influence relevancy. Another tip is to use alt tags when displaying images. (Alt tags provide the text that displays while an image is loading.) Most search indexes pick up alt text as text; therefore, alt tags provide a good way to influence keyword counts.
It’s Time to Move In
Now that I’ve shown you how to create your own search engine, it’s time to figure out how you can use it for your business. I work for a huge company with over 250 manufacturing facilities worldwide and more AS/400s than I can count. When a problem occurs at plant A, chances are that it will eventually happen at plants B, C, D, etc. as well. Using the AS/400’s Webserver Search Engine and HTTP Server, I was able to build a centralized database for reporting problems and fixes online. Now, instead of spending hours trying to fix a problem that has already been fixed, I check the Web site first. If someone has already figured out a solution, I can generally fix the problem in a matter of minutes.
Well, it’s time to flip on the TV; Norm and Steve are coming on! Be creative, have fun, and we’ll see you next month on the next episode of “This Old Search Engine.”
References and Related Materials
AS/400 Webserver Search Engine Getting Started: www.as400.ibm.com/ tstudio/http/services/searchinfo.htm
Figure 1: You will use the Create search index screen to build the index.
LATEST COMMENTS
MC Press Online