Thursday, 7 November 2013

Comparison between XML Vs HTML Vs JSON as Search And Promote output

There are many ways too display the Search And Promote outputs. Some clients asks for XML, some may ask JSON and some wants HTML.Let us see what are all the pros and cons of all these outputs? When we decided to go for S&P which format output we can go for.

Advantages of XML:

  1. XML gives greater flexibility to display the results.
  2. It is decoupled from presentation layer with more readabilty.
  3. HTML look and feel can be changed any time without modifying the XML layer.
  4. Same XML output feed can be used for mobile or desktop websites. No dependency on it during implementation.
  5. Less size, more oriented with tags.
  6. Webapp get more flexibility, to include any extra information or to restrict some data from users based on location or anything etc.

Extra changes will need to be made in the webapp to transform XML to HTML

Advantages of HTML:

  1. Everything is ready with the output. 
  2. Website owners need not work on further development because already the output is in html form.

But any change in UI can be an additional task in future.

Advantages of JSON:
  1. Lightweight, more readable.
  2. No xml tags.

Encoding from JSON to html can be a tedious task in the first time. 
In case of multi nested facets, it could be tedious to iterate through the deeper facets.

Update; Adobe Search & Promote is now Adobe Target

Tuesday, 17 September 2013

Wordpress Vs Adobe Search And Promote

People usually ask questions about various CMS integration with Search & Promote. Our answer is any
CMS can be integrated with Adobe Search And Promote. As we explained in previous posts, for any content/product website we can implement search and promote.

If it is a content website, we need to feed the url entry point to search and promote. Also we need to ensure the metadata defined in each page which will be used to map in S&P for better results. Since this is a necessary step for SEO we hope all websites must hold good with this theory.

If it is a product website, create product XML/text feed and feed it to search and promote.

The display logic(S&P output) is one option where in website owners can take better decision on. There can be XML, JSON or HTML outputs. Switiching between output forms after the mplementation gives overhead. So before starting with implementation, one has to decide on the output format.

Search and promote does not depend on any of the CMS / technologies involved in creating a website. Adobe made search and promote totally independent which makes the product unique.

How the CQ handles dynamic facets?

There are cases website uses dynamic facets. These facets appear based on search results. CQ has unique techniques to implement the dynamic facets. CQ also provides slot based facets & facet rails for grouping of websites.

We will be discussing on these features in coming posts.
Update; Adobe Search & Promote is now Adobe Target

CQ/ AEM Integrating with Adobe Search&Promote

People usually use Adobe search and promote with CQ developed websites.
Below is a good tutorial from Adobe blog on how to integrate search and promote with CQ.

Search and promote can be integrated with CQ very easily if you follow above steps.

One of the major requirement when we deal with product website is, the input feed should be in defined format, also the S&P output XML which will be fed to CQ.


The major advantage of implementing CQ with S&P is both are product of same company, so the integration is quite easy. There are very good help tutorials available for S&P integration related FAQ's.

How long it may take?

An ordinary- less complicated website takes 2 weeks time usually and complications are purely on the facet structure, data, product, content structure.

Will S&P implementation can be done by a CQ guy?

S&P has lots of features to customize. If a new person do the work, it could be minimal usage of the product. So its better to approach a professional from Adobe to implement S&P.

Update; Adobe Search & Promote is now Adobe Target, same tutorial can be referred for AEM Integration with Target.

Thursday, 22 August 2013

Search And Promote FAQ

Frequently asked questions: Adobe S&P

 Below given are some usually questions which we hear before proceeding Search & Promote.
 These questions are the usually first questions heard before any search tool implementation.

1) Which site can integrate with S&P?
Anysite. Any site needs to be implemented with search can be done through s&p.

2) Is Day CQ website a mandate for S&P?


3) What components can be done using S&P?

Menu, breadcrumb, paginatione etc any feature to refine the search can be done through S&P.

4) What are the various sites S&P can work with?

Content Search - Crawls the web url and index, then display result
Product search -  Any kind of feeds with product info will be better for such search.

5) Advantage of S&P?

S&P provides better support compared to other searches. They have option to set business rules to promote an item.

6) Procedure to get an S&P Search implementation?

Contact Adobe to get an S&P Account, they also develop it for you and give maintenance and support further .

7) Site search account can be converted to S&P?

Yes Site search is an old version which can be easily converted/migrated into search and promote.  You need to contact Adobe sales team for this.

8) What about Mercado,Google site search migration to S&P?

Any other searches like Mercado, Google search can be also migrated to S&P with some effort.

9) Search And Promote is Free?


10) Is it possible to use attribute loader in CQ as in site search?

Attribute loader is an add on to load additional data from a feed and make it available for index. Answer for the above question is yes. We can use attribute loader in new Search And Promote too.

11) Search and Promote cost?

Contact Adobe Sales Team.

Update; Adobe Search & Promote is now Adobe Target, Refer above page as Adobe Target FAQ.

Wednesday, 31 July 2013

RSS Feeds Vs Search - Promote

Have you ever thought about search & promote with RSS feeds implementation?

Yes it is possible, because RSS feed is an XML with <rss> version title. So its up to the feed reader to read the contents send by search & promote.

How to create RSS feed based search results?

RSS mainly works on its structure. So we need to have the basic structure of RSS and need to finalize the components in a feed (eg:images , title etc). Once this items are finalized use the S&P API to create RSS structure.

Once configured it with search, the new addition will be available through RSS posts for consumption.

Use of RSS with S&P?

When the site owner wants to publish the products or search results based out of each crawl, adding RSS is a very good option.

Update; Adobe Search & Promote is now Adobe Target

Monday, 29 July 2013

Dynamic Facet : facet when its name is not known

Dynamic Facet(facet when its name is not known):

Think a  scenario where user has to create a facet in a search and promote account, but its name is not
known when we start up the S&P configuration. So what we can do?

CQ is going to introduce dynamic facets for this task. So before this let us do a manual work around for the same.

Our requirement is quiet simple. We need a facet which we don't have their name in hand when work is done. Let us fold our sleeves and get into work.
Below are the steps for the same.

1) Define the facets in XML file.

2) Then in index connector we have to access this values to two fields called  test_facet_name,  test_facet_value through record/mapping.

3) This has now to be defined in meta data definition as text fields.Say test_facet_name, test_facet_value
4) In filtering script we need to iterate this name value pair and load the values in some name value fields like test_name1{name,value},test_name2{name,value}.....

5) Now we need to create meta data with text fields test_name1, upto how many unknown named total facets required.

6) There is a limitation in S&P, we need to contact Adobe team to raise the meta data count.

7) Then this name value is is passed to output by creating facets with names  as test_name1, test_name1 etc upto total number of facets.

8) Now display it through presentation layer.(remember to add those in transport layer too.)

Now the dynamic run time generated facets are ready. Actually these facets we are naming in run time, it was created already during configuration.

Wednesday, 12 June 2013

IntelliJ IDEA 11 and CQ5

I was searching in Google for IntelliJ IDEA with CQ5. Found a good tutorial for the same.
Here is a document which explains setup here for anyone else that is interested in setting up IntelliJ and getting started with CQ5.


    IntelliJ IDEA 11
    Apache Maven
    Adobe CQ5 Quickstart – Author Instance
    A knowledge of Apache Maven and how it works

Monday, 10 June 2013

How, When, What - Adobe Search & Promote.

This page contains details of flow of Adobe Search & Promote.

Adobe Search & Promote is one of the leaders in websites Product & Content Searches. How it is different from other technologies is the way we can do customization in search. We can use one of the best feature available in market called promote.

The major aim of any search migration project are given below,

a)    Migration of legacy search system to Search & Promote platform.
b)    Return more relevant results
c)    Use customer-supplied metrics to rank search results

So the flow happens as given below.

•    Create new Search & Promote account for the team.
•    Define metadata schema & configure the URL entry points/ index connector.
•    Using report widgets to see data populated by verifying all results are indexed, verifying all results are returned in the data view & verify that keyword searches are returning best results as offered by S&P.
•    Designing search result pages
•    Facet based search implementation.
•    Implement Sort, facet, breadcrumb, pagination etc.
•    implement best way of navigation by making it easy for users to navigate results using nested facets.
•    More details on content search (data views, sort etc) and transport layer.
•    The output can be configured to deliver HTML or XML as requested by clients.
•    We can do ranking of results based on metrics on previous searches.

Extra Notes:

•    Debug any issues with the search functionality using debug options available and also through analyzing the transport layer output.
•    Then using business rules, direct hits we can display promotional content, such as banners, depending on specific search contexts.

We recommend adobe search & promote for any product/content search in any type of website. If you need assistance, contact Adobe:

Found we are violating in any of the content of the web page, please contact us through
Update; Adobe Search & Promote is now Adobe Target

Friday, 24 May 2013

Adobe Search And Promote and performance

Let us see the major things to be taken care to avoid performance issues while implementing Adobe S and P.
As we know search and promote has got many advantages and abundant modes of customization while
implementing for a websearch.

Usually a web can have content search and if it is a website which sells products, there are product searches available to implement. Same time we need to ensure some of the things while we implement it, which can affect the performance of search.

1) Rules implementation.

There are pre and post searches in any search process. So in Search and Promote we should ensure the post search should be minimal and it should not execute many times (need another new search = 0).

2) Templates should be light: There should not be unnecessary loops and keep temlates always light. it helps to improve the performance.

3) Filed table/attribute table implementation: Ensure the field table to be not executed during first page load. ie, always create field table when *only* required.

Wednesday, 27 March 2013

How to use a different Synonym Provider other than Wordnet in CQ?

When we enable spell checker in CQ5, the default synonym provider class is which is used to perform the spell check.

WordNet uses semantic algorithms to match synonyms. The service that CQ5 is using (WordNet Search - 3.1) works with the Perl implementation of it.

Another way could be,
the spell checker can be configured by using our own properties file as mentioned below

<param name="synonymProviderClass" value="org.apache.jackrabbit.core.query.lucene.PropertiesSynonymProvider"/>

<param name="synonymProviderConfigPath" value=""/>

Some cases enabling the WordNet synonym providerdo not always meet the spell check need.

Doing semantic analysis programmatically will always create some false positives. If we can live with them we could use WordNet. Otherwise we could look for a different approach based on or just static files.

If we want to implement an additional provider besides the existing one we would need to use a wrapper class for this.

Tuesday, 26 March 2013

How to do automatic versioning of asset in DAY CQ?

Through CQ it can be done as follows :

Let us see, is there a way where we can configure the versions to be created automatically when an asset is modified externally and uploaded back with same name?

You could do the same using VersionManager API and eventlistner. Please look at A sample example is provided @

Creating versions of a content element (including assets) is a powerful feature within the content repository API. CQ takes advantage of this feature, e.g. when you activate a page a version is created automatically.

You have to though be aware that creating versions takes a toll on your disk space. Every version created is a snapshot of the last content-element (usually the Web page). And the version folder grows fast and huge.

When you activate a 'page', a version is created automatically. However, you can always have CQ create versions automatically, although we recommend to be cautious with creating versions for assets (due to the asset size and the disk space consumption). If  want to create asset versions automatically, you want to first think when is the best time to do so. This could be e.g. when you update an asset or when you activate an asset. In both cases you can update workflows (DAM Update and/or Activate workflows).

Another way : You can also try to make changes on a page and then check "Sidekick" to see if a version has been created. Then you can do the same thing with an asset, e.g. change some meta data.

jcr:content versus _jcr_content in URL paths of AEM?

AEM seems to use "_jcr_content" when accessing any resource that is part of a page.
This also means the dispatcher seems to expect that in the URLs, since it will create the following file structure:
/page/_jcr_content/par/other stuff and images etc.

When a page is activated/flushed/deleted, the dispatcher deletes the HTML file and the complete "_jcr_content" folder that goes with it - and all is fine.
Now when "jcr:content" is used instead, e.g. in a Javascript that loads a json, like:
this will also work fine, because CQ/Apache Sling is able to figure out the right resource.
But the dispatcher will cache it in a subfolder like

 The main issue here is with Windows OS that could not create folders with “:” in their name. As a result of this dispatcher cache could not be created.
On publish side CQ converts “Jcr:content” to “_jcr_content”. So always make sure that JS calls to resources in CQ publish instance had “jcr:content” converted to “_jcr_content”.

Thursday, 14 March 2013

How to exclude pages / pages with specific components from the CQ dispatcher cache?

If you ever need to explicitly exclude a page or a page containing a specific component from the dispatcher cache, you can do so by setting the following response header, for example in a component's JSP, like this:

      response.setHeader("Dispatcher", "no-cache"); 

For more information see:

Additional Notes:

   > you do not need to "hardcode" any content paths in your dispatcher config, but can control this dynamically from CQ. This means if you have certain page types or templates that should not be cached, you can use them dynamically anywhere in your content tree without having to modify the dispatcher cache config
   > since it is a http request header, it does not need to be added in a specific position on the HTML page. This means any component can "set" it and make the page a no-cache page.
   > you can even "switch" a previously cached page that's in the dispatcher cache directory to a dynamic no-cache version on the fly: all you need to do is activate that page OR auto-invalidate it by activating another page in the same statfileslevel subtree. The dispatcher will permanently remove the page from it's directory in that case. This allows for scenarios like: a component that requires a page not to be cached is added on to a previously cached page, the page is activated and henceforth no longer cached (the header is added to CQs response by the component).
   Scenarios where we can use this:
    #Cache (or un-cache) pages based on a component driven design - just like the example above;
    #Get away from content hierarchy or page-specific based caching designs. Earlier we had to have /ajax/dynamic/* as non-cached and any page that was not to be cached had to be put in this location (what we did for NASCAR). With this approach i can have a page anywhere and use the template to instruct dispatcher to ignore it. This would mean any new pages using same template would also follow same caching strategy;
    #Dispatcher can be configured to say "cache everything" and then i can control caching from CQ page design hence decoupling the two

Wednesday, 13 March 2013

How to set permission on a Dam-asset for a component?

Let us see how do we set permissions

How to set permissions for thumbnail-image renditions for a dam asset. for example: even if a user does not logged in(where an anonymous user does not have permission to that asset), he can see thumbnail image of that asset, but can not access it.

This can be achieved by setting up following allow node using glob permission policies which allow to set up permission on basis of patterns. This configuration will be required at the node/path where the permission is denied for anonymous user-

        rep:principalName="<anonymous user/ group>"

As the thumbnail files in cq5 starts with name - cq5dam.thumbnail, above pattern for glob permissions policy sets up read permission for required user/group for all the files starting with above name under the given path.

Where the data in CRX Repository saved when we enter in Dialog and Design Dialog box respectively?

CQ has two types of dialogs:

    "dialog": The content entered with this dialog is stored directly to the paragraph on the current page.
    "design_dialog": The content entered is stored to a "design page" created in /etc/designs.

In previous versions of CQ, back to CQ 4, the idea of the design dialog was to store content in a place other than the paragraph of the current page. Since in the early days this type of content was related mostly to design content (e.g. font size of a navigation, etc.) this page was called a "design page".

The design page is assigned to a content page via "page properties". In the page properties you can select a design page and every new child page you create will "inherit" that design page. If there is no custom design page, then the "default" design page will be used (/etc/designs/default). Note that you cannot do anything with the design page, it's simply a node to collect content provided via "design_dialog". So if you have content you want to share among the child pages, you can use a design dialog so store it to a design page.

Hope this helps.

Wednesday, 20 February 2013

Control Replications & Filters in Day CQ

How to?
How to allow replication of content from particular content hierarchy. for e.g. only user generated content (/content/usergenerated) should be replicated through replication agents.


Usually replication agents doesn't provide content filter functionality to control the replication from agents.However we can achieve the same from below.

To do this simply create a new user, deny this user read access on the root of the content tree you do not wish to get replicated. Then configure Agent User Id of the replication agents you do not want to replicate this content with the user ID you just created. The replication agent will only replicate content it can read with this Agent User Id.

Below picture explains the settings.

Encoding issue with Adobe CQ5.4

Let us think some scenarios where UTF 8 Characters are included in fields. Say we have dialog which contains a textfield, whose value is used later as a request parameter in a servlet. The configuration goes as below.

The XML segment for this simple textfield is shown below (from the dialog.xml) :

                                        defaultValue=" " 

The dialog also contains a button which, when pressed, is calling a servlet creating a page. The page is created using the 'name' property shown above. Below you can see the JS segment performing the servlet call, when pressing the aforementioned button:

    var locationTagField = CQ.Ext.getCmp('location-tag'); 
      var languageField = CQ.Ext.getCmp('location-available-languages'); 
      var nameField = CQ.Ext.getCmp('location-name'); 
      var jsonURL = CQ.shared.HTTP.getPath() + '/_jcr_content.' + itemtype 
      + '.json?action=createprofilepage&generationlanguage=' 
      + languageField.getValue() + '&location=' 
      + locationTagField.getValue()[0] + '&title=' + nameField.getValue(); 
      var url = CQ.HTTP.externalize(jsonURL, true); 
      var json = CQ.Util.eval(url); 

Below you can see the Java code sgement related to the page creation:

    final String title = slingRequest.getParameter(Constants.PARAM_TITLE); 
    //parentPath and template values are provided as parameters to the relevant method. 
    return resolver.adaptTo(PageManager.class).create(parentPath, null, template, title); 

Issue: Once the page gets created, a special character like ü for Anüssel or Villünkl has encoding issue. E.g it becomes "Asüsersel" instead of "Asüsersel ".

 The above issue is usually a UTF-8. Let us see how to resolve this.


It can be easily resolved as below. Set the encoding of the from that you are submit e.g. UTF-8 by the hidden field _charset_. What the default encoding is the different Sling Versions is detailed here. Apache Sling - Request Parameters[] (see paragraph at the end about Character Encoding)

Wednesday, 13 February 2013

Enterprise Search Tools Available

Below are list of enterprise search tools available in market.

Company Name; Product Name
Adobe ;Adobe Search & Promote
Aduna ;Cluster Map
Ami Software ;AMI Enterprise intelligence
Antarctica Systems ;Visual Net
Aptek ;AptekSearch 1.0
Atomz ;Atomz Search
Autonomy ;IDOL Universal Search
Black Tulip Systems ;Onezeek
BlackBall ;SearchIn Professional
BrightPlanet ;Deep Query ManagerTM
Convera ;Vertical Search Service
Copernic ;Copernic Desktop Agent
Coveo Solutions ;Coveo Platform version 7.0
CrownPeak Technology ;Site Search
DevTech ;SiteSurfer
Dieselpoint ;Dieselpoint Search
Doclinx ;TeraXML Enterprise Search
dtSearch ;dtSearch
Fluid Dynamics Software Corporation ;Fluid Dynamics Search Engine
FreeFind ;FreeFind
Front Logic ;TYPENGO N300 Search
Funnelback ;Funnelback 7
Google ;Google Search Appliance
IBM ;Omnifind Enterprise
Index Data ;Zebra
Intelligent Search ;NameSearch
Intelligenx ;Discovery Engine
Internet WorkShop;Glimpse; WebGlimpse
ISYS Search Software ;ISYS 8 Suite ;IT-Discovery
JObjects International ;QuestAgent; naisQuest
Kroll Ontrack ;Engenium Search ;Ksearch ;mnoGoSearch
Lextek ;Onix Full Text Indexing and Retrieval Toolkit
LOGIKA ;FusionBot
Matt's Script Archive ;Simple Search
Microsoft ;SharePoint 2010
Miracle Concepts ;IDKSM Search Engine
Multim ;Windex Search
Namazu Project ;Namazu
Netrics ;Matching, Decision, & Reporting Engines
Network Solutions ;SiteMiner
Northern Light Group ;SinglePoint
omCollab ;MIKE2.0
Open Objects Software, Limited ; Managed Search Service
Technology Group ; OpenFTS
Open Text ;OpenText Discovery Server; OpenText Federated Query Server
Oracle ;Oracle Endeca Guided Search
Oracle ;Secure Enterprise Search
Perlfect Solutions ;Perlfect Search
PHD Computer Consultants ;findinsite
Picosearch ;PicoSearch
Progress Software ;Easy Ask Business Edition
Recommind ;Decisiv Search
RiSearch ;RiSearch; RiSearch Pro; RiSearch PHP; RiSearch SQL; RiFlex
S.L.I. Systems ; Learning Search
SAP ;SAP Netweaver Enterpise Search
SITEFORUM Group ;SiteForum
Smartlogic ;Semaphore Classification Server
Spiderline ;Spiderline
SurfRay ;Ontolica Search Preview
The Nutch Organization ;Nutch ( web-scalable search engine)
Thunderstone Software ;Webinator 5.1, Thunderstone Search Appliance
WizSoft ;WizDoc
Wrensoft ;Zoom Search Engine
Xapian Project ;Xapian Code Library

Search & Promote

This page gives the complete update on Adobe Search And Promote Migrations.
It includes meta data spec, breadcrumb creation, facets navigation, s&p account creation, data view, verify data and further things.
First steps of S&P

Data Collection       
The first step in all S&P implementations is to make sure the XML Feed from the client is perfect without any issues.
    Setup Meta Definitions in S&P based off of Meta XLS Sheet

    Setup Index Connector   
    Setup URL Entry Point   
    Create the Staged Index   
    Wait for Index Completion   
        If errors exist (more than single digits) look for reason and fix

Reporting & QA       
The second major step in all S&P implementation projects is to make sure the Data Collection is free of any errors.   
    Create Data Views with valid fields   

    Search Components       
The third major step in all S&P implementation projects is to create the search components.      
Define Facets       
Page Navigation       

The following steps ensure that all fields are present in the XML Feed.       
JSON Transport Template       
    Add all Facets   
    Add all Search Results

Presentation Layer   
It helps to fetch the output . It could be HTML/XML or JSON format 

Guided XML Template       
    Add all Menus   
    Add Breadcrumbs   
    Add Pagination   
    Add all Facets   
    Add all Search Results   
Check Generated XML Feed       
    Look over XML Feed for all desired fields.   
A major step in S&P is creating a simulation to view search experience on the live site. In order to effectively create a simulator, several presentation files must be created.       
Create Rule       
    Setup Pre-Search Rule   
        The presentation rule will trigger the right simulator template for viewing.

Set up post search rules
Set up business rules.

Take the S&P account to live.

Update; Adobe Search & Promote is now Adobe Target

Wednesday, 6 February 2013

How to make tag input field accept a single value in CQ5.4

Is there any way to make a Tag input field  (aka a widget with xtype="tags") to accept a single value?

In usual case we can do this manually (e.g. on 'add' event); To achieve this through a property we can follow below methods.



"fieldLabel":"Select one tag",












Tuesday, 5 February 2013

How to Refresh dialog after JCR data change in CQ5.4

There has to be a refresh functionality in one of the real development case. A custom dialog in CQ5.4, which having below functionality,

    A static text which shows some information based on data found in CRX repository; Having a button which -when pressed- will call a servlet, generating a bunch of pages.
    After pages have been created successfully, we need the dialog to get "refreshed" automatically in order to show the updated information in CRX repository. Ideally, the dialog should reload from scratch but which is not working in actual.


Let us do this by,

<refresh jcr:primaryType="nt:unstructured"   handler="function(){window.location.reload();}"   text="Refresh"/>
Otherway is, if the call to the servlet not an ajax call then we could register a callback to refresh the custom widget, once the ajax call was success full. How to use ajax calls with jQuery for building components in CQ5 is shown here:

Tuesday, 29 January 2013

How to automate Adobe CQ CRXDLite data ingestion?

Can we automate the data ingestion into Adobe CQ CRXDLite through any third party tool or using selenium webdriver api.

To find a mechanism to read data ( nodes and their properties) from CRX , here are the methods.

here we need to have method call(s) from the test cases that fetch this expected data. The data can be retrieved using one of the following methods:

   a) You can access the data from CRX in xml or json format  - You will need to pass the appropriate URL to the method and parse the response.
   b) You can access the data from your CRX instance using apache jackrabbit api

Further thoughts:
If we think deeper on this, its better to refrain from using selenium or web driver to read data from CRX  because the process will be slow, error prone and will require lot of exception handling.

 Adobe shipped inbuilt selenium automation test suite based on selenium RC along with adobe day cq5. solution is in the form of zip file. But If we need to modify java source file and rebuild solution how can we do that?Is there any way to automate adobe day cq5 using selenium webdriver or RC.

Here CQ generates dynamic html ids for the elements so 'id' should not be part of object location strategy. Using firebug we can find out that html elements have many other attributes like class, name etc. By making use of these attributes to locate the objects to get a solution.

 For elements with only ids , narrow down on them locating their parent elements and then select the element using a distinctive factor like index, copy text etc.

Tuesday, 22 January 2013

CQ Redirects based on 'Locale'

There are some cases when the user needs to be redirected to the main page of the website according to his browser default language settings. For eg: if the user locale is set to 'fr' , 'French' site should open; else default English version. Next possible requirement could be, if user selects the 'en' language link , the user should be redirected to ENGLISH site from the 'fr' locale.

Let us see how to go ahead with this:

We can go for two approaches to achieve this :

    1)  JSP Redirects , [Redirect by reading the HTTP Request parameters].
    >   Site root node as template /components/pages/redirect
    >    Within the content.jsp of this page call some business logic to perform
    >    Now use business logic to evaluate the accept-language header and then a redirect based on language with a default language in case the header value did not cover an available language node.
    2)  Apache HTTP rewrite rule , [By using mod_rewrite and redirect based on the Accept-Language header].
* Say, we have a request for the root URL / then redirect to the language version of a home page with a HTTP 301

* Remember home page root directory path is domain dependent

* Use country-specific redirect for international toplevel domains such as it, de, fr

* Now accept-Language with english: serve en.html

  RewriteCond   %{HTTP:Accept-Language} ^en    

  RewriteRule   ^/$     /en.html       

  * Accept-language=COUNTRYID or no Accept-Language header or anything else: serve <lang>.html

  RewriteRule   ^/$     /de.html       

Which approach is better ?

The second approach is better compared to first. The advantage of this approach is that it reduces the load on your CQ instance significantly, because Apache can handle all requests to "/" - which is typically the most popular URL for every site/domain.

Monday, 14 January 2013

Localization does not work with CQ 5.4? I18n.getMessage is not giving localized messages?

People reported when trying to localize Javascript validation messages through CQ.I18n.getMessage("<key>"); reply messages are always in English language however if we use fmt:message this seems returning correct language specific message.

Below code works fine.
<fmt:message key="auto_recharge_dayofeverymonth"/>

Below code not working
<script> alert("hi"+CQ.I18n.getMessage("auto_recharge_dayofeverymonth"));</script>

Above seems to be a CQ issue.

Let us see a temporary fix for this.

required: "Please enter email to proceed.",

All hardcoded messages should be in the i18n folder, map them into key- value pair and replace with below code.
required: '<fmt:message key="email_validation_text_01"/>',

Permanent fix can be done using setting up the locale for CQ.

We need to set locale on the top of the page. CQ.I18n.setLocale("en");

example code to validate,

<fmt:message key="Install Package"/> <input type="label" value="" id="pp">

  <input type="label" value="<%=request.getRequestURI().split("/")[3]%>" id="test">




var qpp = CQ.I18n.getVarMessage("Install Package");   //Message("Install Package");



Hope this helps.

Thursday, 10 January 2013

Search and Promote Queries


      What the difference is between staged/publish live URLs in Search and promote?
Staged is used for testing purpose and no need to push the items live for testing purpose.

So if actual live url is, then staged URL would be,

       Where the Re-directs are mentioned?
Redirects are mentioned in Business Rules as shown below