Sun Java System Web Server 6.1 SP9 Administrator's Guide

Chapter 18 Using Search

Sun Java System Web Server 6.1 includes a search feature that allows users to search documents on the server and display results on a web page. Server administrators create the indexes of documents against which users will search (called collections), and can customize the search interface to meet the needs of their users.

This chapter includes the following sections:

About Search

The search feature is installed with other web components during the installation of Sun Java System Web Server. Search is configured and managed at the virtual server level instead of the server instance level, as it was with Sun Java System Web Server 6.0.

The Search tab in the Virtual Server Manager is used to configure search for each virtual server. From this tab you can:

Information obtained from the administrative interface is stored in the <server-root>/config/server.xml file, where it is mapped within the VS element.

Server administrators can customize the search query and search results pages. This might include rebranding the pages with a corporate logo, or changing the way search results appear. In previous releases this was accomplished through the use of pattern files. Pattern files are not supported in Sun Java System Web Server 6.1. Instead, customizing is now performed using a set of JSP tag libraries included with the product. These libraries provide functionality similar to that provided by the pattern files. For more information about customizing the search interface, see Customizing Search Pages.

There is no global “on” or “off” functionality for search as there was in previous releases. Instead, a default search web application is provided and then enabled or disabled on a specific virtual server. This search application provides the basic web pages used to query collections and view results. The search application includes sample JSPs that demonstrate how to use the search tag libraries to build customized search interfaces.


Note –

Unlike Sun Java System Web Server 6.0, version 6.1 does not provide access checking on search results. Due to the number of potential security models and realms, it is impossible to perform security checks and filter results from within the search application. It is the responsibility of the server administrator to ensure that appropriate security mechanisms are in place to protect content.


Sun Java System Web Server 6.1 provides support for multiple document search. Documents with different formats (such as HTML, ASCII, and PDF) can be indexed and searched against.


Note –

Sun Java System Web Server 6.1 does not support search on multiple document formats on the Linux platform.


The search engine used in previous releases has been replaced in Sun Java System Web Server 6.1 with a new search engine. Therefore, when you migrate from a previous release of the Web server to Sun Java System Web Server 6.1, your existing search collections and indexes are not migrated.

Enabling the Search Application for a Virtual Server

Search is enabled for a virtual server by enabling the search application included with Sun Java System Web Server. The administrative interface is used to enable search.


Note –

The Java web container must be enabled for search to be enabled.


After ensuring that Java is enabled for the virtual server class that contains the virtual server you want to configure, enable search by performing the following steps.

ProcedureTo enable search

  1. Select the virtual server for which you want to enable search, and click the Manage button.

  2. Select the Search tab and then click the Search Configuration link.

  3. Enter the following information:

    • Max Hits. Specify the maximum results retrieved in a search query.

    • URI. If you plan to use a custom search application, enter the URI; if you are using the default search application, you don’t need to specify a value here.

    • Path. If you plan to use a custom search application, enter the path; if you are using the default search application, you don’t need to specify a value here.

    • Enabled. Check this to enable the default search application.

  4. Click OK.

Disabling the Search Application for a Virtual Server

Search is disabled for a virtual server by disabling the search application included with Sun Java System Web Server. The administrative interface is used to disable search.

To disable search for a virtual server, perform the following steps.

ProcedureTo disable search for a virtual server

  1. Select the virtual server for which you want to disable search, and click the Manage button.

  2. Select the Search tab and then click the Search Configuration link.

  3. Uncheck the Enabled checkbox.

  4. Click OK.

About Search Collections

Searches require a database of searchable data against which users will search. Server administrators create this database, called a collection, which indexes and stores information about documents on the server. Once the server administrator indexes all or some of server’s documents, information such as title, creation date, and author is available for searching.

Please note the following about collections:

This section includes the following topics:

Creating a Collection

Collections are created and managed from the administrative interface. You create a new collection by specifying the documents to be indexed.

To create a new collection, perform the following steps

ProcedureTo create a new collection

  1. Select the virtual server in which you want to create a collection, and click the Manage button.

  2. Select the Search tab and then click the Create Collection link.

  3. Enter the following information:

    • Directory to Index: From the drop-down list, select the directory from which documents will be indexed into the collection. Only the directories visible from this virtual server will be listed.

      To view the contents of the directory, click View. If the selected directory has subdirectories, these are listed out in the “View directory_name” page. To select a directory to index, click index. To view a directory, click on the folder.

      In order to add a directory to the list of indexable directories, you must first create an additional document directory. For more information, see Setting Additional Document Directories.

    • Collection Name: Enter a name for the collection.

    • Display Name: (Optional) This will appear as the collection name in the search query page. If you don’t specify a display name, the collection name serves as the display name.

    • Description: (Optional) Enter text that describes the new collection.

    • Include Subdirectories? If you select No, documents within the subdirectories of the selected directory will not be indexed. The default is Yes.

    • Pattern: Specify a wildcard to select the files to be indexed. For more information on wildcards, see Wildcards Used in the Resource Picker.


      Caution – Caution –

      Use the wildcard pattern judiciously to ensure that only specific files are indexed. For example, specifying *.* might cause even executables and perl scripts to be indexed.


    • Default Encoding: Specify the character encoding for the documents to be indexed. The default is “ISO-8859-1.” The indexing engine tries to determine the encoding of HTML documents from the embedded meta tag. If this is not specified, the default encoding is used.

      Documents in a collections are not restricted to a single language/encoding. Every time documents are added, only a single encoding can be specified; however, the next time you add documents to the collection, you can select a different default encoding.

  4. Click OK.

    This creates a new collection by the specified name in the following location:

    <instance-root>/collections/<vs-id>/<collection-name>

    It also creates an appropriate SEARCHCOLLECTION entry in the server.xml file.

Configuring a Collection

After a collection has been created, you can modify some of its settings. These settings are stored in the server.xml file. When you reconfigure a collection, the server.xml file is updated to reflect your changes.

You should avoid making unnecessary changes to collection settings.

ProcedureTo reconfigure an existing collection

  1. Select the virtual server that contains the collection you want to configure, and click the Manage button.

  2. Select the Search tab and then click the Configure Collection link.

  3. From the Collection drop-down list, select the collection you want to configure and click Go.

  4. You can edit the following information for the collection you selected:

    • Display name: (Optional) This will appear as the new collection name in the search query page.

    • Description: (Optional) Edit the text description of the collection.

    • Document URI: Edit the URI for the document root for the search collection.


      Note –

      Do not change the Document URI unless you have changed the URI mapping for the document root from the Additional Document Directories page. For more information, see Setting Additional Document Directories.


    • Enabled: Select Yes to enable. If you select No, the collection will not appear on the search query page.

  5. Click OK

    This reconfigures the collection and modifies the appropriate SEARCHCOLLECTION entry in the server.xml file.

Updating a Collection

You can add or remove files after a collection has been created. Documents can be added only from under the directory that was specified during collection creation. If you are removing documents, only the entries for the files and their metadata are removed from the collection. The actual files themselves are not removed from the file system.

To update a collection, perform the following steps.

ProcedureTo update a collection

  1. Select the virtual server that contains the collection you want to update, and click the Manage button.

  2. Select the Search tab and then click the Update Collection link.

  3. From the Collection drop-down list, select the collection you want to update.

  4. Docs

  5. You can update the following information for the collection you selected:

    • Include subdirectories? If you select No, documents within the subdirectories of the selected directory will not be indexed. The default is Yes.


    Note –

    Include Subdirectories? has a bearing on only adding documents.



    Caution – Caution –

    While adding documents, use the wildcard pattern judiciously to ensure that only specific files are indexed. For example, specifying *.* might cause even executables and perl scripts to be indexed.


    • Default Encoding. Specify the character encoding for the documents to be indexed. The default is “ISO-8859-1.” The indexing engine tries to determine the encoding of HTML documents from the embedded meta tag. If this is not specified, the default encoding is used.

      Documents in a collections are not restricted to a single language/encoding. Every time documents are added, only a single encoding can be specified; however, the next time you add documents to the collection, you can select a different default encoding.

  6. Click Add Documents to add documents to the index, or Remove Documents to remove the appropriate index entries.


    Note –

    You can add documents only if they are located in the directory you specified when you created the collection.


Removing a Collection

You can remove a collection after it has been created. When a collection is deleted, it is no longer visible to users on the search query page, and all configuration and index files associated with the collection are deleted. The actual documents that formed the collection are not deleted from the file system, just their index entries in the collection are deleted.

To remove a collection, perform the following steps.

ProcedureTo remove a collection

  1. Select the virtual server that contains the collection you want to remove, and click the Manage button.

  2. Select the Search tab and then click the Maintain Collection link.

  3. From the Collection drop-down list, select the collection you want to remove.

  4. Click the Remove Collection button.


    Note –

    When a collection is removed, the maintenance scheduled for the collection is also removed. For information about scheduled maintenace, see Adding Scheduled Collection Maintenance.



    Note –

    Do not use your local file manager to remove collections because doing so will not update the corresponding configuration files.


Maintaining a Collection

Periodically, you may want to maintain your collections. These tasks may not be necessary unless you index and update collections frequently. You can:

Reindexing a Collection

You can reindex a collection after it has been created. If any documents are modified after the collection was created, the collection is reindexed. Reindexing a collection does not index any new content into the collection, but rather updates the existing contents of the collection. If index entries exist for documents that are no longer present in the server file system, those entries will be removed.

To reindex a collection, perform the following steps.

ProcedureTo reindex a collection

  1. Select the virtual server that contains the collection you want to reindex, and click the Manage button.

  2. Select the Search tab and then click the Maintain Collection link.

  3. From the Collection drop-down list, select the collection you want to reindex.

  4. Click the Reindex button.

Adding Scheduled Collection Maintenance

You can schedule maintenance tasks to be performed on collections at regular intervals. The tasks that can be scheduled are reindexing and updating. The administrative interface is used to schedule the tasks for a specific collection. You can specify the:

To add regular maintenance of a collection, perform the following steps

ProcedureTo add regular maintenance of a collection

  1. Select the collection you want to schedule maintenance for and click the Add Scheduled Maintenance link.

  2. Enter the following information:

    • Task. Select the task you want to automate. The choices are reindex and update.

      If you select Update, you must enter the following information:

      • Recurse Subdirectories? If you select No, documents within the subdirectoriesof the selected directory will not be indexed. The default is Yes.

      • Pattern. Specify a wildcard to select the files to be indexed. For more information on wildcards, see Wildcards Used in the Resource Picker.


      Caution – Caution –

      Use the wildcard pattern judiciously to ensure that only specific files are indexed. For example, specifying *.* might cause even executables and perl scripts to be indexed.


      • Default Encoding. Specify the character encoding for the documents to be indexed. The default is “ISO-8859-1.” The indexing engine tries to determine the encoding of HTML documents from the embedded meta tag. If this is not specified, the default encoding is used.

        Documents in a collections are not restricted to a single language/encoding. Every time documents are added, only a single encoding can be specified; however, the next time you add documents to the collection, you can select a different default encoding.

      • Scheduled Time. (Required) Specify the time of day, in the HH:MM format, when you want the scheduled maintenance to run. For example, you might want to scheduled maintenance to run at the end of the day when it is likely that the documents in the collection have been modified.

      • Schedule day(s) of week. (Required) Check one or more of the checkboxes to specify the day or days of the week when the scheduled maintenance will run.

  3. Click OK.


    Note –

    UNIX/Linux users must restart the cron control process after adding scheduled maintenance, in order for their changes to take effect.


Editing Scheduled Collection Maintenance

If your requirements change, you can change the properties of the scheduled maintenance for a collection. You might for example, decide to reschedule maintenance keeping in mind the time when your site is most likely to be updated.

To change the scheduled maintenance for a collection, perform the following steps.

ProcedureTo change the scheduled maintenance for a collection

  1. From the Collection drop-down list, select the collection for which you want to reschedule maintenance.

  2. Select the task you want to reconfigure, and enter the necessary information. For more details, see the Edit Scheduled Collection page in the online help.

  3. Click OK.


    Note –

    When a collection is removed, the maintenance scheduled for the collection is also removed.



    Note –

    UNIX/Linux users must restart the cron control process after reconfiguring scheduled maintenance, in order for their changes to take effect.


Removing Scheduled Collection Maintenance

You can cancel scheduled maintenance of a collection if it is no longer needed.

To cancel scheduled maintenance, perform the following steps.

ProcedureTo cancel scheduled maintenance

  1. From the Collection drop-down list, select the collection for which you want to remove maintenance.

  2. Select the task you want to for which you want to remove scheduled maintenance: Reindex or Update. If a task is scheduled the details are now displayed.

  3. For an Update task, check the Delete checkbox next to the task you want to remove.

  4. Click OK.


    Note –

    UNIX/Linux users must restart the cron control process after removing scheduled maintenance, in order for their changes to take effect.


Performing a Search

Users are primarily concerned with asking questions of the data in the search collections, and getting a list of documents in return. The search web application installed with Sun Java System Web Server provides default search query and search results pages. These pages can be used as they are, or customized using a set of JSP tags as described in Customizing Search Pages.

Users search against collections that have been created by the server administrator. They can:

Server administrators must provide users with the URL needed to access the search query page for a virtual server.


Note –

Unlike Sun Java System Web Server 6.0, version 6.1 does not provide access checking on search results. Due to the number of potential security models and realms, it is impossible to perform security checks and filter results from within the search application. It is the responsibility of the server administrator to ensure that appropriate security mechanisms are in place to protect content.


The Search Page

The default URL end-users can use to access search functionality is:

http://<server-instance>:port number/search

Example:

http://plaza:8080/search

When the end-user invokes this URL, the Search page, which is a Java web application, is launched.


Note –

For more detailed information about conducting basic and advanced searches, including information about keywords and optional query operators, see the online Help provided with the search engine. To access this information, click the Help link on the Search page.


The following figure shows the default Search interface:

Figure 18–1 The Default Sun Java System Web Server Search Page

The Default Sun Java System Web Server Search Page

You can customize this page using a set of JSP tags as described in “Customizing Search Pages.”

Search Query Operators

The following table contains the list of search query operators:

Table 18–1 Search Query Operators

Operator 

Description 

Examples 

AND

  • Adds mandatory criteria to the search.

  • Finds documents that have all of the specified words.

Antarctica AND mountain climb  

Finds only documents containing both Antarctica and mountain climb plus all the stemmed variants, such as mountain climbing.

<CONTAINS>

  • Finds documents containing the specified words in a document field. The words must be in the exact same sequential and contiguous order.

  • You can use wildcards. Only alphanumeric values.

  • Does not rank documents for relevance

Title <CONTAINS> higher profit  

Finds documents containing the phrase higher profit in the title. Ignores documents with profits higher in the title.

<ENDS>

  • Finds documents in which a document field ends with a certain string of characters.

  • Does not rank documents for relevance

Title <ENDS> draft 

Finds documents with titles ending in draft.

equals (=)

Finds documents in which a document field matches a specific date or numeric value  

Created = 6-30-06  

Finds documents created on June 30, 2006. 

greater than (>)

Finds documents in which a document field is greater than a specific date or numeric value. 

Created > 6-30-06  

Finds documents created after June 30, 2006.  

greater than or equal to (>=)

Finds documents in which a document field is greater than or equal to a specific date or numeric value. 

Created >= 6-30-06  

Finds documents created on or after June 30, 2006.  

less than (<)

Finds documents in which a document field is less than a specific date or numeric value. 

Created < 6-30-06 Finds documents created before June 30, 2006.  

less than or equal to (<=) 

Finds documents in which a document field is less than or equal to a specific date or numeric value. 

Created <= 6-30-06 Finds documents created on or before June 30, 2006.  

<MATCHES>

  • Finds documents in which a string in a document field matches the character string you specify.

  • Ignores documents that contain partial matches.

  • Does not rank documents for relevance.

<MATCHES> employee  

Finds documents containing employee or any of its stemmed variants such as employees.  

<NEAR>

Finds documents that contain the specified words. The closer the terms are to each other in the document, the higher the document's score. 

stock <NEAR> purchase  

Finds any document containing both stock and purchase, but gives a higher score to a document that has stock purchase than to one that has purchase supplies and stock up.  

<NEAR/N>

Finds documents in which two or more specified words are within N number of words from each other. N can be an integer up to 1000. Also ranks the documents for relevance based on the words' proximity to each other. 

stock <NEAR> purchase 

  • Finds documents containing the phrases stock purchase and purchase stock

  • Ignores documents containing phrases like purchase supplies and stock up because stock and purchase do not appear next to each other.

  • When N is 2 or greater, finds documents that contain the words within the range and gives a higher score for documents which have the words closer together.

NOT

Finds documents that do not contain a specific word or phrase.  


Note –

You can use NOT to modify the OR or the AND operator.


surf AND NOT beach  

Finds documents containing the word surf but not the word beach. 

OR

  • Adds optional criteria to the search.

  • Finds any document that contains at least one of the search values.

apples OR oranges  

Finds documents containing either apples or oranges.  

<PHRASE>

Finds documents that contain the specified phrase. A phrase is a grouping of two or more words that occur in a specific order. 

<PHRASE> (rise "and" fall)  

Finds documents that include the entire phrase rise and fall. The and is in quotes to force the search to interpret it as a literal, not as an operator.  

<STARTS>

  • Finds documents in which a document field starts with a certain string of characters.

  • Does not rank documents for relevance

Title <STARTS> Corp  

Finds documents with titles starting with Corp, such as Corporate and Corporation.  

<STEM>

(English only)  

Finds documents that contain the specified word and its variants.  

<STEM> plan  

Finds documents that contain plan, plans, planned, planning, and other variants with the same meaning stem. Ignores similarly spelled words such as planet and plane that don't come from the same stem.  

<SUBSTRING>

  • Finds documents in which part or all of a string in a document field matches the character string you specify.

  • Similar to <MATCHES>, but can match on a partial string

  • Does not work with wildcards.

  • Does not rank documents for relevance.

 

<SUBSTRING> employ  

Finds documents that can match on all or part of employ, so it can succeed with ploy.  

<WILDCARD>

  • Finds documents that contain the wildcard characters in the search string. You can use this to get words that have some similar spellings but which would not be found by stemming the word.

  • Some characters, such as * and ?, automatically indicate a wildcard-based search, so you don't have to include the word <WILDCARD>

<WILDCARD> plan 

  • Finds documents that contain plan, plane, and planet as well as any word that begins with plan, such as planned, plans, and planetopolis.

  • See the next section for more details and examples.

<WORD>

Finds documents that contain the specified word.  

<WORD> theme  

Finds documents that contain theme, thematic, themes, and other words that stem from theme.  

Making a Query

A search query page is used to search against a collection. Users input a set of keywords and optional query operators, and then receive results on a web page displayed in their browser. The results page contains links to documents on the server that match the search criteria.


Note –

Server administrators can customize this search query page, as described in “Customizing Search Pages.”


To make a query, perform the following steps.

ProcedureTo make a query

  1. Access the Search web application by entering its URL in the Location bar of your browser, in the following format:

    http://<server-instance>:port number/search

  2. In the search query page that appears, check the checkbox representing the collection you want to search in the "Search in" field.

  3. Type in a few words that describe your query and hit the ’enter’ key (or click on the Search button) for a list of relevant web pages.

    For a more fine-tuned search, you can use the search parameters provided in the Advanced Search page, described in the following section.

Advanced Search

Users can increase the accuracy of their searches by adding operators that fine-tune their keywords. These options can be selected from the Advanced Search page.

The following figure shows the advanced search page:

Figure 18–2 The Advanced Search Page

The Advanced Search Page

To make an advanced search query, perform the following steps.

ProcedureTo make an advanced search query

  1. Access the Search web application by entering its URL in the Location bar of your browser, in the following format:

    http://<server-instance>:port number/search

  2. Click the Advanced link.

  3. Enter any or all of the following information:

    • Search in. Select the collection you want to search.

      • Find. Four options are supported:

        • All of the words. Finds pages that include all the key words specified in Find.

        • Any of the words. Finds pages that include any of the key words specified in Find.

        • The exact phrase. Finds pages that match the exact phrase used in Find.

      • Without the words. The search will exclude Web pages that contain the specified words.

      • Title “does/does not“ contain. Restrict the search to pages with titles that include the specified key words.

      • Since. Restrict the search operation to Web pages indexed in the selected time period.

Viewing Search Results

Search results are displayed in the user’s browser on a web page that contains HTML hyperlinks to documents on the server that match the search criteria. Each page displays 10 records (hits) by default, which are sorted in descending order based on relevance. Each record lists information such as file name, size, date of creation, and so on. The matched words are also highlighted.


Note –

Server administrators can customize this search results page, as described in Customizing Search Pages.


Customizing Search Pages

Sun Java System Web Server includes a default search application that provides basic search query and search results pages. These web pages can be used as is, or customized to meet your specific needs. Such customizing might be as simple as rebranding the web pages with a different logo, or as complex as changing the order in which search results are displayed.

Pattern files are no longer used to customize the search interface, as they were in Sun Java System Web Server 6.0. Instead, customizing is now done using a set of JSP tag libraries included with Sun Java System Web Server 6.1. The default search application provides sample JSPs that demonstrate how to use the search tag libraries to build customized search interfaces. You can take a look at the default search application located at /bin/https/webapps/search as a sample application that illustrates the use of customizable search tags.

The default search interface consists of four main components: header, footer, query form, and results.

These basic elements can be easily customized simply by changing the values of the attributes of the tags. More detailed customizing can be accomplished using the tag libraries.

This section includes the following topics:

Search Interface Components

The Search interface consists of the following components:

Header

The header includes a logo, title, and a short description.

Footer

The footer contains copyright information.

Form

The query form contains a set of check boxes representing search collections, a query input box, and submit and Help buttons.

Results

The results are listed by default in 10 records per page. For each record, information such as the title, a passage, size, date of creation, and URL are displayed. A passage is a short fragment of the page with matched words highlighted.

Customizing the Search Query Page

The query form contains a list of checkboxes for search collections, a query input box, and submit button. The form is created using the <s1ws:form> tag along with <collElem>, <queryBox>, and <submitButton> tags with default values:

<s1ws:form>
    <s1ws:collElem>
    <s1ws:queryBox> <s1ws:submitButton>
</s1ws:form>

The query form can be placed anywhere in a page, in the middle, on a side bar, and so on. It can also be displayed in different formats such as with a cross bar where the collection select box, the query string input box, and the Submit button are lined up horizontally, or in a block where the collections appear as checkboxes, and the query input box and Submit button are placed underneath.

The following examples show how the <searchForm> set of tags may be used to create query forms in different formats.

In a horizontal bar

The sample code below would create a form with a select box of all collections, a query input box and a submission button all in one row.

<s1ws:form>
    <table cellspacing="0" cellpadding="3" border="0">
    <tr class="navBar">
        <td class="navBar"><s1ws:collElem type=”select”/></td>
        <td class="navBar">
            <s1ws:querybox size="30"/>
            <s1ws:submitButton class="navBar" style="padding: 0px; 
margin: 0px; width: 50px"/>
        </td>
    </tr>
    </table>
</s1ws:form>

In a Sidebar Block

You can create a form block in which form elements are arranged in a sidebar, and has the title "Search", which uses the same format as other items on the sidebar. The effect of such an arrangement is as shown in the following figure:

Figure 18–3 Customized Query Page with Form Elements in a Sidebar

Customized Query Page with Form Elements in a Sidebar

In the sample code given below, the form body contains three checkboxes arranged in one column listing the available search collections. The query input box and the Submit button are placed underneath:

<s1ws:searchForm>
    <table>
<!--... other sidebar items ... -->
    <tr class="Title"><td>Search</td></tr>
    <tr class="Body">
        <td>
        <table cellspacing="0" cellpadding="3" border="0">
        <tr class="formBlock">
            <td class="formBlock"> <s1ws:collElem type="checkbox" 
cols="1" values="1,0,1,0" > </td>
        </tr>
        <tr class="formBlock">
            <td class="formBlock"> <s1ws:querybox size="15" 
maxlength="50"> </td>
        </tr>
        <tr class="formBlock">
            <td class="formBlock"> <s1ws:submitButton class="navBar" 
style="padding: 0px; margin: 0px; width: 50px"> </td>
        </tr>
        </table>
        </td>
    </tr>
    </table>
</s1ws:searchForm>

Customizing the Search Results Page

Search results are generated as follows:

You can customize the search results page simply by changing the attribute values of the tags.

The following sample code starts with a title bar, and then displays a number of records as specified, and finally, a navigation bar. The title bar contains the query string used in the search along with the range of total records returned, for example, 1– 10. For each record, the records section shows the title with a link to the file, up to three passages with keywords highlighted, the URL, the date of creation, and the size of the document.

At the end of the section, the navigation bar provides links to the previous and next pages, as well as direct links to eight additional pages before and after the current page.

<s1ws:formAction >
<s1ws:formSubmission success="true" >
    <s1ws:search scope="page" >
    <!--search results-->
    (...html omitted...)
        <s1ws:resultStat formId="test" type="total" ></b> Results 
Found, Sorted by Relevance</span></td><td>
        <span class="body"><a href="/search/search.jsp?">Sort by 
Date</a></span></td>
        <td align="right"><span class="body">
        <s1ws:resultNav formId="test" type="previous" caption="<img 
border=0 src=\"images/arrow-left.gif\" alt=\"Previous\">" >
        &nbsp;<s1ws:resultStat formId="test" type="range" >
        &nbsp;<s1ws:resultNav formId="test" type="next" caption="<img 
border=0 src=\"images/arrow-right.gif\" alt=\"Next\">" >
        &nbsp; <!img alt="Next" src="images/arrow-right.gif" 
border="0" WIDTH="13" HEIGHT="9">
            (...html omitted...)
        <table border=0>
        <s1ws:resultIteration formId="test" start="1" results="15">
            <tr class=body>
                <td valign=top>
                <s1ws:item property=’number’ >.&nbsp;&nbsp;
                </td>
                <td>
                    <b><a href="<s1ws:item property=’url’ 
>"><s1ws:item property=’title’ ></a></b>
                    <br>
                    <s1ws:item property=’passages’ >
                    <font color="#999999" size="-2">
                    <s1ws:item property=’url’ > -
                    <s1ws:item property=’date’ > -
                    <s1ws:item property=’size’ > KB
                    </font><br><br>
                </td>
            </tr>
        </s1ws:resultIteration>
        </table>
        (...html omitted...)
        <s1ws:resultNav formId="test" type="previous" >
        <s1ws:resultNav formId="test" type="full" offset="8" >
        <s1ws:resultNav formId="test" type="next" >
    (...html omitted...)
</s1ws:formSubmission>

The following figure shows the customized search results page:

Figure 18–4 Customized Search Results Page

Customized Search Results Page

The basic search result interface can be easily customized by manipulating the tags and modifying the HTMLs. For example, the navigation bar may be copied and placed before the search results. Users may also choose to show or not show any of the properties for a search record.

Besides being used along with a form, the <search>, <resultIterate> and related tags may be used to listed specific topics. The following sample code lists the top ten articles on Java Web Services on a site:

<s1ws:search collection="Articles" query="Java Web Services" >
<table cellspacing="0" cellpadding="3" border="0">
  <tr class="Title"><td>Java Web Services</td></tr>
</table>
<table cellspacing="0" cellpadding="3" border="0">
<s1ws:resultIteration>
<tr>
<td><a href="<s1ws:item property=’URL’ >"> <s1ws:item property=’Title’></a></td>
</tr>
</s1ws:resultIteration>
</table>

Customizing Form and Results in Separate Pages

If you need the form and results pages to be separate, you must create the form page using the <form> set of tags and the results pages using the <formAction> set of tags.

A link to the form page needs to be added in the results page for a smooth flow of pages.

Tag Conventions

Note the following tag conventions:

Tag Specifications

Sun Java System Web Server includes a set of JSP tags that can be used to customize the search query and search results pages in the search interface.

For a complete list of JSP tags that you can use to customize your search pages, refer to the Sun Java System Web Server 6.1 Programmer’s Guide to Web Applications.