Showing posts with label ATG-Search. Show all posts
Showing posts with label ATG-Search. Show all posts

Monday, March 26, 2012

ATG Paging Search Results


An individual search query can return a large number of results. Rather than displaying all of the results on
a single page, you will typically want to break them up into multiple pages, with a certain number of
items per page. Therefore, the query includes properties that you can use to specify the number of items
to include per page and which page to display.
This chapter describes these pagination properties and their effects. It includes the following topics:


Specifying the Page Size
Handling Page Requests
Types of Paging
Modifying and Resubmitting the Request


Specifying the Page Size


 You use the pageSize request attributes to specify the number of items per page. For example, if
pageSize=10, the results will include ten items per page.
The following JSP fragment creates a drop-down for selecting a value for the pageSize attribute:

Page Size
<dsp:select bean="${FH}.searchRequest.pageSize"> 
  <dsp:option value="100">100</dsp:option> 
  <c:forEach begin="5" end="35" step="5" var="pageSize"> 
    <dsp:option value="${pageSize}"> 
      <c:out value="${pageSize}"/> 
    </dsp:option> 
  </c:forEach> 
</dsp:select> 


Handling Page Requests



When you render the initial page of results, you typically want to render links to other pages of results.
Each of these links actually issues a new search query that in most respects is identical to the original

query, but which specifies a different page of results. So paging involves a sequence of connected
requests and responses.
To display a specific page of results, you set the form handler’s goToPage property to a 1-based page
number. The goToPage property has an associated handler method, handleGoToPage. When a user
clicks a link that sets the value of goToPage, the handleGoToPage method issues the search for the
specified page.
To ensure that all of the requests and responses in a sequence of page requests are associated with each
other, the initial query generates a unique String identifier called a request chain token. This identifier is
included in each query in the sequence of requests, and is returned in each response.
There are various paging options available, and the ones you use depend on the needs or your site. The
following options are explained below:

· The type of paging to use: normal paging or fast paging
· Whether to save the request in the search session or not


Types of Paging 



ATG Search supports two types of paging, normal paging and fast paging. The key differences between
them relate to the information you get back from the search engine about the number of pages of results,
and the navigation you can build into your pages:

· Normal paging is the default. In this mode, the search engine returns (in the form
handler’s pagesAvailable property) the total number of pages of results. You can
create links that enable the customer to go directly to any page.

· Fast paging is specified by setting the fastPaging property of the search request to
true. In this mode, the search engine does not return information about the total
number of pages of results; pagesAvailable is set to the highest-numbered page
that has been rendered so far. You can enable customers to go to the next page or to
any page previously rendered.

For a single-partition index, normal paging is always enabled (the fastPaging property is ignored). For a
multi-partition index, you can choose between normal paging and fast paging, but fast paging is
recommended. Fast paging is much less resource-intensive than normal paging. On multi-partition
indexes, normal paging can be very memory- and CPU-intensive, because results from the partitions must
be merged.

Example of Normal Paging :


The following example renders a list of the page numbers of all pages of results. Each page number is a
link to the corresponding results page, except for the current page number, which is displayed without a
link. For example, if pagesAvailable is 43 and the current page is page 10, this code will render the
integers from 1 to 43, and all of these except 10 will be links. If the user clicks 22, for example, a request to
display page 22 will be issued.


<!-- Indicate that the request should be saved in the search 
     session so that initial request data, such as the question 
     text, is available to subseqent paged requests. --> 
<dsp:input bean="QueryFormHandler.searchRequest.saveRequest" 
           value="true" type="hidden"/> 
<!-- Display page numbers with links to take user to specified 
     page --> 
Go to Page: 
<c:forEach var="page" begin="1" end="${formHandler.pagesAvailable}"> 
  <c:choose> 
    <c:when test="${page == (1+formHandler.searchResponse.pageNum)}"> 
      ${page} <!-- The current page, don't display a link --> 
    </c:when> 
    <c:otherwise> 
      <dsp:a href="normal-paging.jsp"> 
        ${page} 
        <dsp:property bean="QueryFormHandler.searchRequest.requestChainToken" 
                      value="${formHandler.searchResponse.requestChainToken}"/> 
        <dsp:property bean="QueryFormHandler.searchRequest.saveRequest" 
                      value="true"/> 
        <dsp:property bean="QueryFormHandler.goToPage" value="${page}"/> 
      </dsp:a> 
    </c:otherwise> 
  </c:choose> 
</c:forEach> 


Example of Fast Paging 



The following example renders a list of the page numbers of the results pages that have been rendered so
far. Each page number is a link to the corresponding results page, except for the current page number,
which is displayed without a link. In addition, the example renders the word “more” as a link to the page
following the current one.

<!-- Turn on fast paging --> 
<dsp:input type="hidden" value="true" 
           bean="QueryFormHandler.searchRequest.fastPaging"/> 
<!-- Indicate that the request should be saved in the search 
     session so that initial request data, such as the question 
     text, is available to subseqent paged requests. --> 
<dsp:input bean="QueryFormHandler.searchRequest.saveRequest" 
           value="true" type="hidden"/> 
<!-- Shortcut to the response object, which may be null --> 
<c:set var="response" value="${formHandler.searchResponse}"/>


<!-- Display page numbers with links to take user to specified 
     page --> 
<c:if test="${response != null}"> 
  on page: ${1+response.pageNum}<br/> 
  Go to Page: 
  <c:forEach var="page" begin="1" end="${1+formHandler.pagesAvailable}"> 
    <c:choose> 
      <c:when test="${page == (1+response.pageNum)}"> 
        ${page} <!-- current page --> 
      </c:when> 
      <c:otherwise> 
        <dsp:a href="fast-paging.jsp"> 
          <c:choose> 
            <c:when test="${page == (1+formHandler.pagesAvailable) && 
                            response.multiPartitionSearch && 
                            formHandler.searchRequest.fastPaging}"> 
              more 
            </c:when> 
            <c:otherwise> 
              ${page} 
            </c:otherwise> 
          </c:choose> 
          <dsp:property bean="QueryFormHandler.searchRequest.requestChainToken" 
                        value="${formHandler.searchResponse.requestChainToken}"/> 
          <dsp:property bean="QueryFormHandler.searchRequest.saveRequest" 
                        value="true"/> 
          <dsp:property bean="QueryFormHandler.goToPage" value="${page}"/> 
        </dsp:a> 
      </c:otherwise> 
    </c:choose> 
  </c:forEach> 
</c:if>


Modifying and Resubmitting the Request:



Since subsequent requests differ only in the requested page of results, it is most efficient just to retrieve
the most recent search request, change the value of the goToPage property, and resubmit the request.
There are two ways to do this:

· Modify properties on the form, and resubmit it. This avoids the memory use required
to save the request in the SearchSession. The downside is that resubmitting the
form is difficult if you are creating your links through anchor tags. In that case, it is
generally easiest to write a JavaScript function that makes the necessary changes and
submits the form.

· Save the request in the SearchSession. This allows you to retrieve the request,
modify it, and reissue it; no JavaScript is necessary. The downside is that this approachcan
use a lot of memory, especially if there are many users at your site issuing search
queries.

Note that resubmitting a modified request is useful for faceted search as well as for paging.


Example of Resubmitting the Form:


If you do not want to save the request in the SearchSession, you will need to resubmit the form. Create
a JavaScript function like this:

function nextPage(pageNum, requestChainToken) 

  document.searchForm.requestChainToken.value = requestChainToken; 
  document.searchForm.goToPage.value = pageNum; 
  document.searchForm.submit(); 
  return false; 


You can then invoke the function when the user clicks on a link for a specific page:

<a href="#" onclick="return nextPage('<%=pageValue.toString()%>', 
 '${formHandler.searchResponse.requestChainToken}');"> 
  <dsp:valueof param="count"/> 
</a> 

When the link is clicked, the page number associated with the link and the requestChainToken of the
current search response are passed to the function. The function uses these values to set the goToPage
property and the requestChainToken property of the form, which it then submits. In addition to
specifying the results page to display, this ensures that the same requestChainToken value is associated
with each subsequent search request.

Example of Saving the Request in the SearchSession


If you save the request in the SearchSession, you can avoid the use of JavaScript. Instead, when a user
clicks on a link for a page, you set the necessary properties (including the saveRequest property) on the
saved request through dsp:property tags, and then resubmit the request:

<dsp:a href="queryExampleFastSave.jsp#Paging"> 
  <dsp:valueof param="count"/> 
  <dsp:property bean="QueryFormHandler.goToPage" paramvalue="count" 
    name="fh_gtp" priority="29"/> 
  <dsp:property bean="QueryFormHandler.searchRequest.saveRequest" 
    value="true" name="fh_sr" priority="30"/> 
  <dsp:property 
    bean="QueryFormHandler.searchRequest.requestChainToken" 
value="${formHandler.searchResponse.requestChainToken}" 
    name="fh_rct" priority="30"/> 
</dsp:a> 


Sunday, January 15, 2012

ATG Type of Paging

ATG Search supports two types of paging, normal paging and fast paging. The key differences between them relate to the information you get back from the search engine about the number of pages of results, and the navigation you can build into your pages:

Normal paging is the default. In this mode, the search engine returns (in the form handler’s pagesAvailable property), the total number of pages of results. You can create links that enable the customer to go directly to any page.

Fast paging is specified by setting the fastPaging property of the search request to true. In this mode, the search engine does not return information about the total number of pages of results; pagesAvailable is set to the highest-numbered page that has been rendered so far. You can enable customers to go to the next page or to any page previously rendered.

For a single-partition index, normal paging is always enabled (the fastPaging property is ignored). For a multi-partition index, you can choose between normal paging and fast paging, but fast paging is recommended. Fast paging is much less resource-intensive than normal paging. On multi-partition indexes, normal paging can be very memory- and CPU-intensive, because results from the partitions must be merged.

Example of Normal Paging

The following example renders a list of the page numbers of all pages of results. Each page number is a link to the corresponding results page, except for the current page number, which is displayed without a link. For example, if pagesAvailable is 43 and the current page is page 10, this code will render the integers from 1 to 43, and all of these except 10 will be links. If the user clicks 22, for example, a request to display page 22 will be issued.

<dsp:input type="hidden" bean="QueryFormHandler.searchRequest.requestChainToken"
    name="requestChainToken"/>
<dsp:input type="hidden" bean="QueryFormHandler.goToPage" name="goToPage"
    beanvalue="Constants.null" converter="nullable"/>


<dsp:droplet name="For">
  <dsp:param bean="QueryFormHandler.pagesAvailable" name="howMany"/>
  <dsp:oparam name="output">
    <dsp:droplet name="Switch">
      <dsp:param bean="QueryFormHandler.goToPage" name="value"/>
      <dsp:getvalueof id="pageValue" param="count" idtype="java.lang.Integer">
        <dsp:oparam name="<%=pageValue.toString()%>">
          <%--Switch value matched the current page, so just render the page num,
          not a link--%>
          <dsp:valueof param="count"/>
        </dsp:oparam>
      </dsp:getvalueof>
      <dsp:oparam name="default">
        <%--the other pages are links--%>
        <dsp:a href="queryExampleNormalSave.jsp#Paging">
          <dsp:valueof param="count"/>
          <dsp:property bean="QueryFormHandler.goToPage" paramvalue="count"
             name="fh_gtp" priority="29"/>
          <dsp:property bean="QueryFormHandler.searchRequest.saveRequest"
             value="true" name="fh_sr" priority="30"/>
          <dsp:property bean="QueryFormHandler.searchRequest.facetSearchRequest"
             value="true" name="fh_fsr" priority="30"/>
          <dsp:property bean="QueryFormHandler.searchRequest.requestChainToken"
             value="${formHandler.searchResponse.requestChainToken}" name="fh_rct"
             priority="30"/>
        </dsp:a>
      </dsp:oparam>
    </dsp:droplet>
  </dsp:oparam>
</dsp:droplet>


Example of Fast Paging

The following example renders a list of the page numbers of the results pages that have been rendered so far. Each page number is a link to the corresponding results page, except for the current page number, which is displayed without a link. In addition, the example renders the word “next” as a link to the page following the current one.

<dsp:input type="hidden" bean="QueryFormHandler.searchRequest.requestChainToken"
    name="requestChainToken"/>
<dsp:input type="hidden" bean="QueryFormHandler.goToPage" name="goToPage"
    beanvalue="Constants.null" converter="nullable"/>


<dsp:droplet name="Switch">
  <dsp:param bean="QueryFormHandler.pagesAvailable" name="value"/>
  <dsp:oparam name="1">
    <%--one page, but in the fast case we need to show a '1' and provide a Next
     link b/c fast always starts with only one and we don't know if there'll be
     more--%>
    <c:if test="${multi}">
       1 <dsp:a href="queryExampleFastSave.jsp#Paging">
          next
         <dsp:property bean="QueryFormHandler.goToPage" value="2" name="fh_gtp"
          priority="29"/>
         <dsp:property bean="QueryFormHandler.searchRequest.saveRequest"
                         value="true" name="fh_sr" priority="30"/>
         <dsp:property bean="QueryFormHandler.searchRequest.requestChainToken"
                         value="${formHandler.searchResponse.requestChainToken}"
                         name="fh_rct" priority="30"/>
       </dsp:a>
    </c:if>
    </dsp:oparam>
    <dsp:oparam name="default">
    <%--the remaining pages. render links for page nums other than the current--%>
      <dsp:droplet name="For">
        <dsp:param bean="QueryFormHandler.pagesAvailable" name="howMany"/>
        <dsp:oparam name="output">
          <dsp:droplet name="Switch">
            <dsp:param bean="QueryFormHandler.goToPage" name="value"/>
            <dsp:getvalueof id="pageValue" param="count"
               idtype="java.lang.Integer">
              <dsp:oparam name="<%=pageValue.toString()%>">
                <%--Switch value matched the current page, so just render the
                  page num, not a link--%>
                <dsp:valueof param="count"/>
              </dsp:oparam>
            </dsp:getvalueof>
            <dsp:oparam name="default">
              <%--the other pages are links--%>
               <dsp:a href="queryExampleFastSave.jsp#Paging">
                 <dsp:valueof param="count"/>
                 <dsp:property bean="QueryFormHandler.goToPage" paramvalue="count"
                  name="fh_gtp" priority="29"/>
                 <dsp:property bean="QueryFormHandler.searchRequest.saveRequest"
                                  value="true" name="fh_sr" priority="30"/>
                 <dsp:property
                   bean="QueryFormHandler.searchRequest.requestChainToken"
                   value="${formHandler.searchResponse.requestChainToken}"
                   name="fh_rct" priority="30"/>
               </dsp:a>
            </dsp:oparam>
          </dsp:droplet>
        </dsp:oparam>
      </dsp:droplet>
      <%--Need to show the 'next' link for Fast--%>
      <c:if test="${multi}">
         <dsp:a href="queryExampleFastSave.jsp#Paging">
           &nbsp; next
           <dsp:property bean="QueryFormHandler.goToPage"
            value="${formHandler.goToPage + 1}" name="fh_gtp" priority="29"/>
           <dsp:property bean="QueryFormHandler.searchRequest.saveRequest"
                            value="true" name="fh_sr" priority="30"/>
           <dsp:property bean="QueryFormHandler.searchRequest.requestChainToken"
            value="${formHandler.searchResponse.requestChainToken}" name="fh_rct"
            priority="30"/>
         </dsp:a>
      </c:if>
    </dsp:oparam>
</dsp:droplet>

Creating the Search Page


The search page is a standard search page (e.g., one that issues search requests using the QueryFormHandler) with some additions:

<script> tag that import the JavaScript libraries.

A <div> tag that enables you to associate the type-ahead dropdown with the search text input field.

JavaScript that calls the autocompleter function.

These additions are described below.

Importing the JavaScript Libraries

The script.aculo.us libraries are imported using <script> tags. For example:

<script src="scriptaculous/prototype.js" type="text/javascript"></script>
<script src="scriptaculous/scriptaculous.js" type="text/javascript"></script>


Using a <div> Element

The following example illustrates the use of the <div> element:

<p>Search for: </p>
<dsp:input type="text" id="question" size="30" converter="nullable"
           name="question" bean="QueryFormHandler.searchRequest.question"/>
<div id="autocomplete_choices" class="autocomplete"></div>


Calling the Autocompleter

The example below creates a JavaScript function called buildQueryCallback, which constructs the URL (including query parameters) for rendering the type-ahead page. It also creates a JavaScript function called AutoComp. This function, which is executed when the page loads, calls the Ajax.Autocompleter function with arguments that associate it with the text field and <div> element in the search form shown above. Ajax.Autocompleter renders the type-ahead page using the URL constructed by the buildQueryCallback function, adding a query parameter q whose value is the string currently in the text box.

<script language="Javascript">
function buildQueryCallback(element, entry) {


  entry += "&environment=commerce";
  entry += "&language=english";
  return entry;
}


function AutoComp() {
var myAutoCompleter1 = new Ajax.Autocompleter('question', 'autocomplete_choices',
  'testtypeget.jsp' , {callback: buildQueryCallback, paramName: "q" });
}


document.onload = AutoComp();
</script>


For example, if the user types “fla,” the URL constructed by the JavaScript would be:

testtypeget.jsp?q=fla&environment=commerce&language=english

The query parameters are used to set the input parameters of the TypeAheadDroplet on the type-ahead page.

For more information about the Ajax.Autocompleter function, including additional options that can be specified in the function call, see:

http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter

Thursday, December 29, 2011

Installing Search : ATG SEARCH


Installing Search

This section describes the actual installation process of ATG Search.
To install ATG Search:
1.             Download the ATG Search installation executable.
2.             Start the installer.
3.             On the start page, click Next to begin the installation.
4.             Read the license agreement. Select “I accept the terms of the license agreement” and click Next.
5.             Select Search Administration + Search Engine for the installation type. Click Next.
Enter an installation location, or accept the default. Click Next.
6.             Select locations for product icons and shortcuts.
7.             Review your selections, and click Install to begin the installation.
8.             Enter a Deployment Share folder. This is the scalable, shared directory you created before beginning        the installation.
9.             When the installation is finished, click Done.

Thursday, December 22, 2011

ATG Search Architecture


Objective of the article: is to give a better understanding to a person who is new to this technology.This article will give the reader a walk through on what s/he is going to do and s/he will see once the ATG Search installation is done and also how the entire Search structure pieces fit in.
                      ATG search runs with a standard platform installation.Search requires high performance, so it is better dedicating a seperate machine for the search purposes.
Components of Search Search Administration:
        Is the interface where we create projects, index the data, add content,setting auto indexing rules,deploy indexes etc.We should have only one instance of search administartion in our installation.The SearchAdmin.AdminUI module is required to run the search administration.
Search Engine:
        It serves answers to queries generated by end users.Our installation can have any number of search engines.But make sure only one engine runs per processor.ATG docs say a single search engine can take upto 1.4GB of memory.The “DAF.Search.Routing” module starts the Search engines locally or remotely.It co-ordinates the communication between client application, the search database and the answer servers(search engines).
Search Database:
        Consists of two repositories, one consists of information of search engine,index structure and deployment information.The other repository stores information about users and the search administration. Search engine, administration and routing should have access to the “shared deployment directory“. This directory is the place where the master copy of index files are stored. Search engine and routing should have access to directory in order to deploy the indexes.

ATG Search: Explanation

ATG Search is a search solution for electronic stores. It helps a customer in searching item in a website very easily and shop directly from there, which give a better shopping experience. Directing the customer to a specified item fastly means more revenue. Key features that ATG highlight include integration with the shopping cart; thus helping the customer in checking out directly and also the search filters contents which are out of stock and items already in cart.Another feature is the near real time search update with each content change.ATG Search uses a Natural Language Processing(NLP) instead of a keyword processing.


Now a small note on ATg in their own words:-”ATG (Art Technology Group,Inc., NASDAQ: ARTG) makes the software that the world’s largest and most prestigious companies use to create a relevant and consistent customer experience, across the Web, e-mail, call center, and mobile channels. With ATG, world-class enterprises create and manage highly targeted online commerce and marketing campaigns, as well as loyalty-driving and cost effective knowledge management, customer service, and support initiatives. ATG’s solutions power brands including A&E Networks, Airbus, American Airlines, American Eagle Outfitters, AT&T Wireless, Best Buy,Boeing, France Telecom, Friends Provident, General Electric, Hewlett-Packard, HSBC, InterContinental Hotels Group, Kingfisher, Neiman Marcus, Philips, Procter & Gamble, SBC, T-Mobile, Target, US Army, US Federal Aviation Administration, Wells Fargo, Warner Music, and Yahoo! The company is headquartered in Cambridge, Massachusetts, with additional locations throughout North America, Europe, and Asia. For more information about ATG, please visit www.atg.com.”

ATG-Search : Ideal Production Environment for an e-commerce site


A production setup is normally an alien environment to normal developers. On top of the e-commerce site setup locally, a few patch ups needs to be done to work in the production environment or rather there are large differences. Before going into the details of a production scenario a few important things needs to be brought into your attention; Content Administration (CA), Search Indexer, and electronic Store front. CA is Content or data related thing, the ATG CA lets the product data and other data flow into our website.


 The need of a CA in a retail website is due the frequent change of data and the changes are to be done by the business itself not a database administrator. Search module of the website is clubbed to CA because it is also a portion which needs frequent business intervention. The search administration and merchandising modules are kept as part of the CA ear in a seperate server(Server1). The search indexer which does the indexing is kept in another server(Server-2), this server will have the indexing engine(ATGSearch.exe) in it. 


The index files generated will be put into a folder which is accessible to the answer servers as well. An answer server(AS-1,2,3) is a server which caters to the requests coming from the front end or the consumer side. For eg: a customer enter the webaddress, visits the website, he want to buy a TV, he searches for it, the search requests will be routed to different answer servers for load balancing. This is done through a routing module. The answer servers will look into the index files which is deployed in the shared folder.


The Search Indexer does all the indexing jobs create the .IDX and .STG files. The estore servers(Server-3 & 4) caters the store related requests. Each of the estore servers has many number of instances to handle large number of customer requests.

ATG SearchAdmin UI and How Search Indexing is done?

What I intend to share in this article is a familiarity towards the admin UI screens of the ATGsearch.This article will give you an idea on how search indexing is done, not the code but the front end working in the search application.This will give you a fair idea on what the search guy should do get the products indexed once the coding part is over.Or simply configuring the search project. Figure one shows the BCC(Business control center) which is configured by adding certain UIs in the ATGSearch module.
                   Figure 2 shows the “Search Administration” tab with 4 different options.Search Project administration,New Search Project,Browse Search Projects,Open Search Workbench.Each of these will take you to different options for creating a search project or edit already created ones. Figure 3 and its sub shows how to create a project. Figure 4 shows a project you created and under the name of your project there are 4 steps, of which the last 3 are essential parts of configuring a search project. Content means adding or giving location of the file from which the indexing starts.It is normally  “ProductCatalogOutputConfig.properties“. Environment tab will help you set up  an environment for indexing, which tells where should the search engine run,in local setup your computer name is given.Indexing tab does the indexing job.









Thursday, December 15, 2011

ATG Search: A few key things to note

While answering the question, what is a commerce search?? the key concepts one must explain is the difference of a normal keyword search and a commerce search.ATG Search will help you in setting up a commerce search in your website. Implementing a Commerce Search on your site involves the following steps:

1. Specify repository items and attributes to index through an XML file.
2. Based on the information in the XML file, the repository items are transformed into XHTML documents.
3. These XHTML documents are indexed by ATG Search.
4. Using search forms in your website(form handlers that communicate with ATG Search), visitors can search through these indexed documents.


There are a couple of formhandlers which are out of the box components and are used to build forms for issuing queries to the ATG Search.These formhandlers are provided inside the package “atg.search.query.formhandlers“.
  1. QueryFormHandler
  2. StructuredQueryFormHandler
  3. BrowseFormHandler
  4. ViewInContextFormHandler
  5. SimilarDocsFormHandler
  6. CategorizeFormHandler
All the above form handlers extends from an abstract class “BaseSearchFormHandler“.Another important class is a “SearchContext” class which is a session scoped component for maintaining state information between requests.



Popular Posts