Sun ONE logo      Previous      Contents      Index      Next     

Sun ONE Web Server 6.1 Getting Started Guide

Chapter 5
Making Content Searchable

In this chapter we’ll see how we can make content searchable on a virtual server. Sun ONE Web Server 6.1 includes a search engine that allows users 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.

Before we can enable search on a virtual server, we must first 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 ONE 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.

Let’s walk though a few basic search-related tasks:

Create a Search Collection

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

Figure showing the Create Collection page in the Search tab of the Virtual Server Manager interface.

In the figure above, we’ve specified certain parameters that will define our collection.

You need to save and apply your changes after you’re done for the changes to take effect.

You may 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.

Now that we’ve created our collection, we need to keep some additional points in mind.

Update Your Collection

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

However, if your site is constantly being updated, you might want to 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, and so on, as shown below:

Figure showing the Add Scheduled Maintenance page.

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’re planning on using the default search application, all you need to do is to click the Enabled checkbox on this page and use the default values for the rest of the parameters.

Figure showing the Search Configuration page.

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


Figure showing the search query page.

Customize the Search Application

Finally, you may choose to customize the search application to suit your specific needs. You can use the JSP tag libraries included with Sun ONE 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 Customizing Search Pages in the Sun ONE Web Server 6.1 Administrator’s Guide provides examples of customizing the search page, for example, 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, refer to the Sun ONE Web Server 6.1 Programmer’s Guide to Web Applications.

Previous      Contents      Index      Next     

Copyright 2004 Sun Microsystems, Inc. All rights reserved.