Quickstart: Customizing search

This is a short tutorial for server administrators who need to customize the Netscape search interface to better accomodate their user community. The search interface consists of four types of pages and this tutorial provides information about each type, complete with sample pattern files and output.
For each topic, there is a brief description of the page, a list of items of interest, and a section detailing any special actions that you must take before being able to use the page. You may want to consult Chapter 10, "Using search," of the Netscape Enterprise Server Administrator's Guide for additional information about pattern variables, configuration files, and pattern files. You can also see the Web Publisher online help for search for details of the search query language.

Note: Before you can see results from some of the examples here, you need to have searchable data in your Web Publishing collection. See Chapter 12, "Configuring web publishing," of the Netscape Enterprise Server Administrator's Guide and the Web Publisher online help for more information about Web Publisher and the Web Publishing collection.

Search query pages

Standard query page

This is the standard query page that comes with the default Enterprise Server installation.

Items of interest:

The source pattern file (NS-query.pat)

Display the query page

A canned search query

This query is similar to the standard query page.

Items of interest:

The source pattern file (NS-query-demo1.pat)

Display the query page

The advanced HTML query

This is the query page that is is displayed when users who do not have Java enabled click the Guided Search button on the standard search query page.

Items of interest:

The source pattern file (NS-advquery.pat)

Display the query page

Using a different header for the search results

The default results header (NS-tocstart.pat), record (NS-tocrec.pat), and footer (NS-tocend.pat) pattern files are defined in the dblist.ini configuration file, but you can define others. For example, you can specify a different header NS-tocstart-pat directly from the URL.

Items of interest:

The source pattern file (NS-query-demo2.pat)

Display the original header

Display a different header


Search results pages

The standard search results page

This page uses three pattern files: NS-tocstart-pat defines the header, NS-tocend-pat file defines the footer, and NS-tocrec-pat defines the format for the repeating element in the results.

Items of interest:

The source pattern file (HTML-tocstart.pat)

The source pattern file (HTML-tocrec.pat)

The source pattern file (HTML-tocend.pat)

Display the search results

The Web Publisher search results page

The Web Publishing collection uses a specific record file for its search results.

Items of interest:

The source pattern file (WEBPUB-tocrec.pat)

Display the Web Publishing search results

Display the collection contents


Document display pages

Displaying the entire document as part of your search results

In special cases such as short classified ads, you may want to display not just the attributes associated with the results (like score, title, filename), but the entire document in the results. This is done by using the $$NS-insert-doc macro, which inserts the HTML version of the document into the page. Note that this should only be done with HTML documents.

Note: To test this, you need to create a collection of HTML documents (code samples or classifieds, for example). Modify the dblist.ini configuration file for this collection so that NS-tocrec-pat is set to HTML-tocrec-demo1.pat before you search.

Items of interest:

The source pattern file (HTML-tocrec-demo1.pat)

Display the document

The standard document display page

You can display a single document from the search results list. To do this, you use the $$NS-insert-doc macro in the display document pattern file to create an envelope for HTML documents. This macro retrieves the HTML document and inserts it onto the page as well as highlighting the matching query terms in the document.

NS-doc-number and NS-docs-matched are part of the href generated by the NS-get-highlighted-doc convenience macro. The documentation contains a full listing of all the pattern variables that are legal to pass into the service function.

Note: To test this, you need to create a collection of HTML documents or use an existing HTML collection.

Items of interest:

The source pattern file (NS-query.pat)

Display the standard document display page

Highlighted search query text in the displayed document

You can take advantage of all the attributes stored with content manager data, such as the Web Publisher attributes, to display the attributes as well as the HTML document. The attributes are displayed in a small colored box to the left of the HTML source document.

Note: You need to change the dblist.ini entry for NS-record-pat the Web Publishing collection to point to the HTML-record-demo1.pat pattern file.

Items of interest:

The source pattern file (HTML-record-demo1.pat)

Display the document with highlights


Collection contents pages

The standard collection contents page

This the standard collection contents description page.

Items of interest:

The source pattern file (HTML-descriptions.pat)

Display the collection contents page

A variation on the collection contents page

This page is similar to the standard collection contents page, with some attributes and display fields removed.

Items of interest:

The source pattern file (HTML-descriptions-demo1.pat)

Display the collection contents page