The atg.search.formhandlers package provides a set of eight form handlers for submitting queries to ATG Search. Each form handler implements the logic for constructing one of the eight ATG Search query types. For each form handler, there is a corresponding request class in the atg.search.routing.command.search package. The following table shows the form handler classes and their corresponding request classes and query types:

Form Handler Class

Request Class

Query Type

QueryFormHandler

QueryRequest

<query>

StructuredQueryFormHandler

StructuredQueryRequest

<structquery>

BrowseFormHandler

BrowseRequest

<browse>

ViewDocumentFormHandler

ViewDocumentRequest

<viewInContext>

SimilarDocsFormHandler

SimilarDocsRequest

<similardocs>

CategorizeFormHandler

CategorizeRequest

<categorize>

TreeQueryFormHandler

TreeQueryRequest

<treequery>

TypeAheadFormHandler

TypeAheadRequest

<typeahead>

The form handler classes all have as an ancestor the atg.search.formhandlers.BaseSearchFormHandler abstract class, which implements much of the generic functionality of the form handlers: error handling, URL redirection, maintaining state information, query submission, etc. The CategorizeFormHandler, ViewDocumentFormHandler, and TypeAheadFormHandler classes directly subclass BaseSearchFormHandler. The other form handler classes all subclass PagedRequestFormHandler, which is a subclass of BaseFormHandler that adds support for paging of results.

The request classes have a similar inheritance structure to the form handlers. All eight of the request classes subclass atg.search.routing.command.search.SearchRequest, which has properties that are common to all of the request types. The type-specific subclasses add properties that are unique to the individual request types.

The form handlers construct search queries using the SearchClient API. This API uses an instance of Routing to issue those queries to the search engine. This instance of Routing can be running locally (on the same ATG instance as the SearchClient) or remotely (on a different ATG instance). Information about the connection to Routing is maintained in a session-scoped component of class atg.search.formhandlers.SearchContext. The form handlers and request classes themselves are designed to be request-scoped.

Each search form handler has a handleSearch method that issues the search query. Typically, you associate this method with a form button, so the query is issued when the user clicks the button. For example:

<dsp:input type="submit" bean="QueryFormHandler.search" value=" Search "
   action="query.jsp"/>

The form handlers include a number of other handler methods that you may find useful in building search forms. See the ATG API Reference for more information.

 
loading table of contents...