Tuesday 30 August 2016

Integrate AEM with Adobe Search and Promote


Search and promote(S&P) offers the following features:

  • Search features like auto-complete and "Did you mean?" help the users to get relevant search results.
  • Real-time metrics, merchandising rules, and customer intent.
  • Refinements based on facets and filtering options.
  • Built-in linguistics help in spell-checking and searching for non-English languages.
  • Real-time analytics allow search results to be dynamically ranked according to business objectives.
  • Easily scalable and reliable because S&P is provided as SaaS using cloud infrastructure.
  • Incremental indexing helps in ensuring that visitors are always shown with the up-to-date search results.
Also, for high-traffic websites with huge content, it is always advised to offload the search requests to a dedicated search server to get better performance for search results.
S&P is offered as a SaaS product by Adobe. To login to S&P use the following URL.
On successful login, you are presented with S&P admin dashboard. This dashboard can be used to configure the indexing rules, facets, reports and also for setting the crawling options.

Configuration at S&P end:

Configurations related to indexing rules, facets, crawling options can be configured in the S&P. To add a custom facet goto Design > Navigation > facets in the left navigation menu. You can see the list of facets configured and also an option to add a new facet.

You can also configure the crawling options for your site from the Settings > Crawling > URL entry points.
This main entry point is the URL address from which the search robot begins index crawling. However, if your website has multiple domains or subdomains, or if portions of your site are not linked from the primary entry point, you can use URL entry points to add more entry points.
After you have specified the main URL entry point, you can optionally specify additional entry points that you want to crawl in order. Most often you will specify additional entry points for web pages that are not linked from pages under the main entry point. Specify additional entry points when your website spans more than one domain as in the following example:
[http://www.aemquickstart.in/]
[http://www.aemquickstart.in/notlinked/butsearchmetoo/]
[http://more.aemquickstart.in/]
Also, you can specify keywords after each URL to handle the behaviour for each entry point.
  1. nofollow - Add this keyword if you want your URL to be indexed but you do not want the crawler to follow any page links.
  2. noindex – Add this keyword if you do not want the page to be indexed, but you want the crawler to continue indexing the page links.
Please note that S&P should be always configured to work with AEM publish instance. For QA & stage environment, S&P will not be able to crawl the pages in author instance as by default we need to login to open the pages in author.
Also, for the content to be index-able, proper meta-tags should be added in the pages.
S&P crawlers will parse the information in meta-tags and extract the facet information and build the index accordingly and will be able to provide the refinement options in the search results.
Configuration at AEM end : At the AEM end, the S&P is integrated using Cloud Services Configuration. You need to add the S&P details in cloud services configuration and use the same configuration in your search page.
  • To add the S&P details in cloud services configuration, goto AEM Tools > Cloud Services > Adobe Search & promote.


Provide the member id & account no. for your Search and promote account.
  • Now the last step is to configure our search results page to use this configuration. To do this, goto > page properties > cloud services tab and select the configuration you just created.

Creating the Search Results Page and using Out of the Box S&P components:

Now we will create a page to display the search results coming from S&P.
  1. Create a page in AEM for displaying search results.
  2. Goto Design mode and configure the parsys to display the Search & Promote components in the sidekick.
  3. Drag & drop “Search”, “Results” and “Pagination” components on your page.
  4. Test the results by firing a search keyword in the search component. You should be able to see the search results displayed by the “Results” Component and also pagination of the results.
Also, AEM provides lot of other OOTB s&p components like facets, breadcrumbs etc. You can check each of them for their functionality.

Creating Custom Components using AEM search promote API :

The OOTB cq5 S&P Components are not Ajax based. To create Ajax based S&P components or to extend the functionality of existing components we can use the CQ5 search & promote API provided by AEM. The AEM search & promote API is present under com.day.cq.searchpromote package. The main class in this API is the “Search” class. All the OOTB S&P components use this API to generate the search results content.
Please refer this java documentation for more details about this class. Java Doc for the Search Class
The OOTB S&P components and the searchpromote API are built around XML implementation.
The Search&Promote provides a REST-like API is used that you can interact with to perform searches and receive results. The format of the results can be in any format such as XML, JSON, text, and HTML Search requests consist of the base URI and a set of CGI parameters(query parameters) or key-value pairs that indicate the desired search for the account that is associated with the base URI. By default S&P accepts semi-colon(;) separated parameters.
For building custom components(either server-side or Ajax), we can get the search results in either XML or JSON format by passing proper query parameters. Then an XML or JSON libarary can be used to parse these results and display on our page.
If the S&P is configured to return the results in XML format, then it is recommend to use SAX parser to parse the XML response. Please check the documentation section on the standard xml output format below : Documentation Standard XML Output
If you are creating Ajax based components, then get the results in JSON format and parse the results using javascript.
For more information on how S&P works, please check the S&P user guide provided in the help section of S&P. S&P Help

Good to know:


No comments :

Post a Comment