You can modify the Search Testing UI to add an “Advanced Inputs” section that contains your custom Search Testing inputs. This allows you to test searches using properties that are not included in the default Search Testing configuration. When you save a search test, the value of your input is automatically saved as long as it follows the format provided in the default advancedIputs.jsp file.

Note: ATG does not support changes to the out-of-the-box search test inputs.

This topic contains the following information:

The following figure illustrates how custom inputs appear in Search Testing:

Steps to Add an Input to Search Testing

To add an input to Search Testing:

  1. Create an application module for your customizations. See Creating a New Application Module in the ATG Platform Programming Guide.

    ATG recommends that you create a new module to ensure that you always have a working application and to avoid issues when you upgrade.

  2. If the input you are adding requires a change to the search query request, for example, a date range input that narrows the search results by availability date, you must extend the form handler class used by the atg/search/web/assetmanager/SearchTestingFormHandler component, as follows:

    • Create a subclass of the underlying form handler class, atg.search.web.assetmanager.SearchTestingFormHandler located in DCS-UI.Search.

    • In the subclass, override the preSearch method of the class to implement the search request logic required for your custom search test inputs.

      See Sample Search Testing Form Handler Subclass for sample code that you can use as a starting point.

  3. Copy the advancedInputs.jsp file to your module and give it a custom name, such as myAdvancedInputs.jsp. The file is located in the DCS-UI.Search module at:

    <ATG9dir>/DCS-UI9.1/DCS-UI/Search/j2ee-apps/DCS-UI-Search.ear/
    DCS-UI-Search.war/searchTesting/input

  4. Edit the JSP file to add your custom inputs. Sample code is provided in the default advancedInputs.jsp file as a starting point.

    See Sample Advanced Inputs JSP for an example.

  5. Override the SearchTestingFormHandler component to update the pageConfigMap property with your new JSP file. There are two things you must specify in the mapping:

    • The name and location of the new JSP file.

    • The web application context root for the file. (The context identifies your web application so the DSP include can include that file.)

    The following shows an example of the pageConfigMap property with an updated advanced inputs JSP file:

    pageConfigMap+=\
      advancedInputsPage=/custom/myAdvancedInputs.jsp,\
      advancedInputsContext=DCS-UI-Search,\

    For more information about overriding a component, see the ATG Platform Programming Guide.

  6. In your SearchTestingFormHandler component, update the $class value to reference your new subclass.

  7. (Optional) Customize the results list output to display search result data related to your custom inputs. See Customizing the Results List Output.

  8. Assemble the Merchandising application and include your module in the modules list. See Assembling a Merchandising Application.

  9. Deploy and start Merchandising.

  10. Verify that your new search test inputs work as expected.

Sample Search Testing Form Handler Subclass

Use the following sample code as a starting point for creating a subclass of the atg.search.web.assetmanager.SearchTestingFormHandler class:

Public void preSearch(
  DynamoHttpServletRequest pRequest,
  DynamoHttpServletResponse pResponse
  ) throws ServletException, IOException {

    QueryFormHandler queryFormHandler =
       getQueryFormHandler();
    QueryRequest request =
       (QueryRequest)queryFormHandler.getSearchRequest();
    String myControlValue =
       getAdvancedParameters().get( "myControl" );

    /*
    logic to set something in request based on myControlValue
    */

    super.preSearch( pRequest, pResponse );
  }
Sample Advanced Inputs JSP

The advancedInputs.jsp file contains the following sample code as a starting point for writing the JSP for your custom inputs:

<%@ taglib prefix="c"     uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="dspel" uri="http://www.atg.com/taglibs/daf/dspjspELTaglib1_0"%>
<%@ taglib prefix="fmt"   uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="assetui-search"
     uri="http://www.atg.com/taglibs/assetui search" %>
<%@ taglib prefix="web-ui" uri="http://www.atg.com/taglibs/web-ui" %>

<%-- dspel:page>

<c:set var="formHandlerPath" value="${requestScope.formHandlerPath}"/>
<c:set var="formHandler" value="${requestScope.formHandler}"/>

<dt>My Control:</dt>
<dd>
  <dspel:input id="myControl" type="text" 
    bean="${formHandlerPath}.advancedParameters.myControl" />
</dd>

</dspel:page--%>

Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices