Friday, 20 May 2016

ATG - Endeca | Understanding Assembler Architecture

Here I am going to explain how assembler works behind the scenes.

Few key points about assembler.
1. Accepts Content Item in request.
2. Populates and returns response Content Item. 

Assembler
Assembler

In ATG-Endeca Integration Assembler can be invoked using one of the three ways.
1. InvokeAssembler Droplet [When portion of page is rendered using Assembler].
2. AssemblerPipelineServlet pipeline servlet [When complete page is rendered using Assembler].
3. Custom Droplet [Can be used to render complete or partial page using Assembler].

Here I will explain the assembler mechanism from invokeAssemler() method of the AssemblerTools. 
Below diagram explains this architecture.

Assembler Architecture
Assembler Architecture

Explanation :
1. Application Invokes the invokeAssembler() method of AssemblerTools.
2. Invoke Assembler method calls NucleusAssemblerFactory.
3. NucleusAssemblerFactory returns NucleusAssembler instance.
4. AssemblerTools invoke assemble method of NucleusAssembler.
5. NucleusAssembler creates initial version of root and sub content response items. Here it uses the XML     configuration for content along Experience Manager modifications (From Endeca Configuration repository).
6. NucleusAssembler invokes cartridge handlers on root and each sub content items. Cartridge handlers are used to manipulate the content items.
7. NucleusAssembler return the response content item to AssemblerTools.
8. AssemblerTools return the response content item to Application.

Wednesday, 18 May 2016

MDEX | Revert Endeca Index to Particular Baseline

Follow below steps to revert\restore MDEX indexes to previous baseline update.

1. Stop the MDEX Engine.
2. Clean up dgraph_input and sub directories [Delete the content].
3. Copy the previous backup indexes from dgidx_output.<YYYY_MM_DD.HH_MM_SS> to dgraph_input directory.
4. Start the MDEX Engine. MDEX Engine reads the files in dgraph_input and its sub directories.

Here is the example.

1. Old baseline data

Old Indexed Data

2. Latest indexed data

Latest Indexed Data


3. Restore the old indexed data using above steps



Thursday, 10 March 2016

Update Configuration For Already Provisioned Endeca Application

Follow below steps to push/update endeca application configuration changes to the EAC.

1. Navigate to config/script directory of endeca application.
2. Update component definition in respective xml file. For example here we are going to update authoring dgraph port from 15002 to 15005 in AuthoringDgraphCluster.xml.

AuthoringDgraphCluster.xml

Authoring Dgraph [EAC Admin console snapshot].

Authoring Dgraph Before Update

3.  Navigate to control directory of your application.
4.  Execute runcommand script with --update-definition flag. Below is the command output for given example.
=========================================================================
C:\Endeca\apps\MyStore\control>runcommand.bat --update-definition
[03.10.16 23:06:03] INFO: Checking definition from AppConfig.xml against existing EAC provisioning.
[03.10.16 23:06:04] INFO: Updating definitions for dgraphs in restart group 'A'.
[03.10.16 23:06:05] INFO: Updating definition for component 'AuthoringDgraph'.
[03.10.16 23:06:06] INFO: Updating provisioning for component 'DailyReportGenerator'.
[03.10.16 23:06:07] INFO: Updating definition for component 'DailyReportGenerator'.
[03.10.16 23:06:07] INFO: Definition updated.

=========================================================================

5.  Verify your changes.

Authoring Dgraph After Update


Thursday, 28 January 2016

Endeca Logging And Reporting System

Here We will explore the endeca logging and reporting system. Reports are great tool to capture customer behavior on application usage.

Like :
  • Most popular search on application ?
  • Search conversion rate ?
  • How users are browsing the site ?
  • Search and navigation traffic on site ? 
     
Steps to add logging feature in application.

1. Add Logging requests in application code.
2. Modify Report Settings file if required.
3. Configure Log Server and Report Generator.

How it works ?

1. Send Logging Requests to LogServer using Logging API.
2. LogServer write logging requests to log files.
3. Report Generator reads log files and generate reports.

Key Components of logging and Reporting System.


1. Logging API : Used to Create and submit log requests. Below are two core classes of Logging API.
    a. LogEntry : Key/value pair container for log requests.
    b. LogConnection : Used to connect with LogServer.

Log requests are independent of MDEX Engine requests.

2. Log Server : Translate application log requests to flat file.

3. Report Generator : Generates Endeca reports using below three files.

     a. Log File (generated by log server).
     b. Report Settings File. Default Path , %ENDECA_CONF%\etc\ report_settings.xml.
      c. XSLT Stylesheet. -- Setting to specify whether to generate XML or HTML reports. Default Path , %ENDECA_CONF%\etc\tools_report_stylesheet.xsl

Note : In the case settings file path for a report generator is specified in workbench that settings will be effective.


Customizing Report : You can customize reports.  Below are the most common customization.

1. Disable report sections or items.
2. Setting default and list for Top N items drop down.

Here is the report with all the sections and items.



Report after disabling Sorting section and Top Search Key item.


Here is the report with default Top N value (20).




Report after customizing it to 25.


Report Setting file used for above customization.

=======================================================================
<report_settings>
    <top_n report_item="top_search_terms" n="5, 10, 25, 50" initial_value="25" />
    <disable list="sort, top_search_keys" />
</report_settings>
=======================================================================

Sunday, 24 January 2016

Endeca Implementing a Custom Java Record Manipulator

Follow below steps to write and configure custom java record manipulator.

1.   Write java manipulator using CADK (Content Adapter Development Kit) API classes.
2.   Compile this java manipulator into a JAR file.
3.   Configure manipulator in Forge pipeline.

Below is the example of simple java manipulator.
This record manipulator is doing two tasks.

1. Converting/updating one record property to lower case.
2. Adding one new record property.

=========================================================================
 package com.test.endeca.manipulator;

import com.endeca.edf.adapter.Adapter;
import com.endeca.edf.adapter.AdapterConfig;
import com.endeca.edf.adapter.AdapterException;
import com.endeca.edf.adapter.AdapterHandler;
import com.endeca.edf.adapter.PVal;
import com.endeca.edf.adapter.Record;

public class SimpleJavaManipulator implements Adapter {

    private static final String PASSTHROUGH_SOURCEPROP = "SOURCEPROP";
    private static final String PASSTHROUGH_TARGETPROP = "TARGETPROP";
  

    @Override
    public void execute(AdapterConfig adapterConfig, AdapterHandler adapterHandler)
            throws AdapterException {       
        String sourceprop = adapterConfig.first(PASSTHROUGH_SOURCEPROP);
        String targetprop = adapterConfig.first(PASSTHROUGH_TARGETPROP);
      
        if (sourceprop == null)
            throw new AdapterException(PASSTHROUGH_SOURCEPROP + " passthrough not specified");

        if (targetprop == null)
            throw new AdapterException(PASSTHROUGH_TARGETPROP + " passthrough not specified");
       
        for (int inp = 0; inp != adapterHandler.getNumInputs(); inp++)
        {          
            boolean hasMoreRecords = true;
            long currentRecord = 0;
          
            while(hasMoreRecords)
            {
       
               Record rec = adapterHandler.getRecord(inp);
               if (rec != null)
                {
                    ++currentRecord;
                    String sourcepropValue = null;
                   
                      for (PVal prop : rec)
                      {
                          if (prop.getName().equals(sourceprop))
                          {
                               sourcepropValue = prop.getValue();
                              // update current property to lower case
                              prop.setValue(sourcepropValue.toLowerCase());
                              break;
                          }
                       }
                    // Add new property
                    if (sourcepropValue != null)  {
                        rec.add(new PVal(targetprop,sourcepropValue));                                               
                    }                  
                    adapterHandler.emit(rec);
                } else {
                    hasMoreRecords = false;
                }
            }
        }      
    }

}
=========================================================================

Note : CADK API jar is available at %ENDECA_ROOT%\cadk\lib (adapter.jar).

Once manipulator is implemented and compiled into jar, now configure this manipulator into forge pipeline.
Steps to Configure java manipulator into forge pipeline.

1. Open Endeca application pipeline in developer studio.
2. Right Click then select New then Java Manipulator.


3. In manipulator pop up add general information like java home, manipulator class name and path of the manipulator compiled jar.


4. Add data sources.


5. Add Pass Throughs.


6. Add manipulator as data source in next pipeline component.



7. Now your manipulator is ready. Save the pipeline and run the baseline.

Friday, 22 January 2016

Endeca SEVERE: Unauthorized (401): Unauthorized access to workbench

Endeca application initialization failed with below error.

=======================================================================
[01.23.16 10:12:03] SEVERE: Unauthorized (401): Unauthorized access to workbench. Please check your credentials.
Occurred while executing line 3 of valid BeanShell script:
[[

1|
2|
3|   IFCR.provisionSite();
4|   CAS.importDimensionValueIdMappings("MyStore-dimension-value-id-manager",
5|                   InitialSetup.getWorkingDir() + "/test_data/initial_dval_id_mappings.csv");
6|

]]

[01.23.16 10:12:03] SEVERE: Caught an exception while invoking method 'run' on object 'InitialSetup'. Releasing locks.

Caused by java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl invoke0 - null
Caused by com.endeca.soleng.eac.toolkit.exception.AppControlException
com.endeca.soleng.eac.toolkit.script.Script runBeanShellScript - Error executing valid BeanShell script.
Caused by com.endeca.soleng.eac.toolkit.utility.IFCRUtility$HttpStatusException
com.endeca.soleng.eac.toolkit.utility.IFCRUtility execute - Unauthorized (401): Unauthorized access to workbench. Please check your credentials.
 
=======================================================================

Root Cause : This happened due to ToolsAndFramework installed with password [admin@1234] other then admin.

Update ToolsAndFramework password to admin using below steps.

C:\Endeca\ToolsAndFrameworks\11.1.0\credential_store\bin> manage_credentials.bat add --key ifcr --user admin

Enter password for user admin :

Re-enter password to confirm :

Credential of type [password] already exists for this key.

Do you want to replace it [yes/no] ?yes

23 Jan 2016 10:27:23,954  INFO CSFHandler:146 - Credential successfully updated for map : endecaToolsAndFrameworks.

C:\Endeca\ToolsAndFrameworks\11.1.0\credential_store\bin>


Friday, 8 January 2016

ProductCatalogSimpleIndexingAdmin component indexing phases and indexing buttons are missing

Sometimes when you are working on indexing related components. You may face this issue. In this case ProductCatalogSimpleIndexingAdmin component UI is looks like normal ATG component [indexing phases and indexing buttons are missing].

Below is the screen capture of erroneous ProductCatalogSimpleIndexingAdmin UI.



Root Cause : This happens when any one of the component listed in phaseToPrioritiesAndTasks is not able initialize/start.

Solution : Make sure that there is no error in all components in phaseToPrioritiesAndTasks .

After fixing issue here is the expected UI.