Develop > Controller layer > Application developer > Catalog subsystem > Catalog search methods
Add catalog search to the site
To add catalog search to the site, add the CatalogSearch data bean to each page from which to make a search available.
Once the data bean has been added to the page, set a number of variables. The following table describes the variables and values that set.
Name Data Type Description beginIndex String Used to page the result set. The value is the index of the first result row in a page. categoryId String Used in searches on both category names and descriptions. categoryTerm String Used in searches on both category names and descriptions. categoryTermCaseSensitive String A customer chooses either a case sensitive ('yes'=case sensitive) or a case insensitive ('no'=case insensitive) search. categoryTermOperator String A customer chooses either 'like' or 'equal' as search operators. The value for this variable stores the customer's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator). categoryTermScope Integer A customer restricts the scope of both 'search term' and 'filter term' searches to one of:
- Name and short description
- Name only
- Name, short description and long description
The integer value in this variable stores a customer's choice. The value must be 1 (for name and short description), 2 (for name only), or 3 (for name, short description and long description).
categoryType String A customer specifies three types of search criteria:
- ALL
- ANY
- EXACT
The value for this variable stores a customer's search criteria. The value must be one of 'ALL' (for All search criteria), 'ANY' (for Any search criteria), or 'EXACT' (for Exact phrase criteria).
catgrpSchemaType String The WebSphere Commerce schema allows data to be populated in multiple ways. For example, you can populate the CATGPENREL table with products or both products and items. The queries generated by the bean at run time depend on the type of data in the CATGPENREL table. The value in this variable stores the data population type. The value must be either 1 (if the CATGPENREL contains only products) or 2 (if the CATGPENREL contains both items and products). currency String The value of this variable is used in searches according to currency. currencyCaseSensitive String A customer chooses either a case sensitive ('yes'=case sensitive) or a case insensitive ('no'=case insensitive) search. currencyOperator String A customer chooses either 'like' or 'equal' as search operators. The value for this variable stores the customer's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator). filterTerm String The value in this variable is used to filter a search on a specified value. filterTermCaseSensitive String A customer chooses either a case sensitive ( 'yes'=case sensitive) or a case insensitive ( 'no'=case insensitive) search. filterTermOperator String A customer chooses either 'like' or 'equal' as search operators. The value in this variable stores the customer's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator). filterType String A customer specifies three types of search criteria:
- All
- Any
- Exact Phrase
The value for this variable stores a customer's search criteria. The value must be one of 'ALL' (for All search criteria), 'ANY' (for Any search criteria), or 'EXACT' (for Exact phrase criteria).
manufacturer String The value of this variable is used in searches on a manufacturer's name. manufacturerCaseSensitive String A customer chooses either a case sensitive ( 'yes'=case sensitive) or a case insensitive ( 'no'=case insensitive) search. manufacturerOperator String A customer chooses either 'like' or 'equal' as search operators. The value for this variable stores the customer's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator). manufacturerPartNum String The value of this variable is used in searches on a manufacturer's part number. manufacturerPartNumCaseSensitive String A customer chooses either a case sensitive ( 'yes'=case sensitive) or a case insensitive ( 'no'=case insensitive) search. manufacturerPartNumOperator String A customer chooses either 'like' or 'equal' as search operators. The value for this variable stores the customer's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator). maxPrice String The values of this variable is used in searches on price range. minPrice String The values of this variable is used in searches on price range. pageSize String The value of this variable specifies the number of search result rows to display per page. price String The value of this variable is used in searches on price. priceOperator String A customer chooses one of the following operators as search operators: =, <, >, !=, <=, >=. The value in this variable stores a customer's choice. The value must be any one of the following:
- 'EQUAL'
- 'NOTEQUAL'
- 'GREATER'
- 'LESS'
- 'GREATER_EQUAL'
- 'LESS_EQUAL'
qtyAvailable String The value of this variable is used in searches on inventory of a product or item. qtyAvailableOperator String A customer chooses one of the following operators as search operators: =, <, >,!=, <=, >=. The value in this variable stores a customer's choice. The value must be any one of the following:
- 'EQUAL'
- 'NOTEQUAL'
- 'GREATER'
- 'LESS'
- 'GREATER_EQUAL'
- 'LESS_EQUAL'
qtyMeasure String The value of this variable is used in searches on quantity measure. qtyMeasureCaseSensitive String A customer chooses either a case sensitive ( 'yes'=case sensitive) or a case insensitive ( 'no'=case insensitive) search. qtyMeasureOperator String A customer chooses either 'like' or 'equal' as search operators. The value in this variable stores a customer's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator). RASchemaType String For future use. resultCount String This variable accepts a number that represents the total number of results returned for a search. resultType String The merchant specifies if which of the following they want to show:
- Items only
- Products only
- Products and Items
The value in this variable stores this value. The value must be 1 (items only), 2 (products only), or 3 (both products and items).
searchTerm String The value of this variable is used in searches on a word. searchTermCaseSensitive String A customer chooses either a case sensitive ( 'yes'=case sensitive) or a case insensitive ( 'no'=case insensitive) search. searchTermOperator String A customer chooses either 'like' or 'equal' as search operators. The value in this variable stores a user's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator). searchTermScope Integer A customer restricts the scope of both 'search term' and 'filter term' searches to one of:
- Name and short description
- Name only
- Name, short description and long description
- Keyword
The integer value in this variable stores a customer's choice. The value must be 1 (for name and short description), 2 (for name only), or 3 (for name, short description and long description) or 4 (for keyword).
Long description search is not supported.
searchType String A customer specifies three types of search criteria:
- ALL
- ANY
- EXACT
The value for this variable stores a customer's search criteria. The value must be one of 'ALL' (for All search criteria), 'ANY' (for Any search criteria), or 'EXACT' (for Exact phrase criteria).
sku String The value of this variable is used in searches on SKU. skuCaseSensitive String A customer chooses either a case sensitive ( 'yes'=case sensitive) or a case insensitive ( 'no'=case insensitive) search. skuOperator String A customer chooses either 'like' or 'equal' as search operators. The value in this variable stores the customer's choice. The value must be either 'LIKE' (for like operator) or 'EQUAL' (for equal operator).
For implementation guidelines, refer to the CachedHeaderDisplay.jsp and AdvancedCatalogSearchForm.jsp files in the Consumer Direct and B2B Direct starter stores.
During development, it is useful to enable tracing on the component WC_SEARCH. By looking at the trace log, you can see the generated SQL statements.
Related concepts
Related tasks
Add required fields to the data bean