Sun Java System Web Server 6.1 SP10 Getting Started Guide

Chapter 5 Making Content Searchable

This chapter describes how you can search content on a virtual server. Sun Java System Web Server 6.1 includes a search engine that allows you to search documents on the server and display results on a web page. It provides a default search web application which you can enable or disable on a specific virtual server. This search application provides the basic web pages used to query collections and view results.

Search can be enabled on a virtual server, ensure that Java is enabled for the virtual server class that contains the virtual server. Java is enabled by default and you can enable/disable it per server instance in Sun Java System Web Server 6.1 The Java tab for the virtual server contains a link, the Enable/Disable Java link, that takes you to a page which allows you to enable or disable Java.

Next, because searches require a database of searchable documents (called a collection) against which users can search, you need to create this database. At a minimum, you must have at least one collection configured on your server. You can however create as many collections as required.

This chapter includes the following sections:

Create a Search Collection

Let’s say you want to create a collection called “HR” on your virtual server acme. To do so, use the Create Collection page in the Search tab of your virtual server.

Figure 5–1 Creating a Search collection

Creating a search collection

In the figure above, certain examples are specified. These parameters define our collection.

You need to save and apply your changes after updating the page for the changes to take effect.

You can update any of the parameters in the search collections you have created at any time using the Update Collection link on the Search tab of the virtual server.

Update Your Collection

When you add new documents to the /hr/publish/info folder, update the “HR” collection to index the new documents into the collection by manually using the Update Collections page.

If your site is constantly being updated, schedule regular maintenance tasks on the collection. You might for example, wish to update your collections at the end of the day when you know that new documents are likely to have been added.

To automate maintenance tasks on collections, use the Add Scheduled Maintenance link in the Search tab of the virtual server. Choose Update as the type of task you want to automate, and specify other parameters as appropriate, for example, the time of day to perform the task, the day(s) of the week to perform the task, figure as shown below:

Figure 5–2 Add Scheduled Maintenance Link

Add Scheduled Maintenance link

Enable the Search Application

Next, we need to enable the search application on the virtual server using the Search Configuration link in the Search tab of the virtual server.

If you plan to use the default search application, click the Enabled checkbox on this page and use the default values for the rest of the parameters.

Figure 5–3 Enabling the Search Application

Enabling the Search Application

To view the search query page, enter the following address on a browser window:


Figure 5–4 Search Query Page

Search query page

Customize the Search Application

You may choose to customize the search application to suit your specific needs. You can use the JSP tag libraries included with Sun Java System Web Server 6.1 to do so. Take a look at the default search application located at server_root/bin/https/webapps/search as a sample application that illustrates the use of customizable search tags. The section on Customizing Search Pages in the Sun Java System Web Server 6.1 Administrator’s Guide provides examples of customizing the search page, by having the query form appear on a side bar of the page or search results appear differently.

For a detailed description of the JSP search tags you can use, see the Sun Java System Web Server 6.1 SP10 Programmer’s Guide to Web Applications.