Friday 3 June 2016

Endeca | Expression Record Manipulator

In Endeca record manipulators are used to change the data associated with record during indexing. 
There are 3 types of manipulators available.

1. Perl Manipulators
2. Java Manipulators
3. Record (Expression) Manipulators

Here we will learn how to configure  Record (Expression) Manipulators.

Below are the steps to configure Record (Expression) Manipulators.

1. Open Endeca project in developer studio.
2. Right Click on pipeline editor select New then Record followed by Manipulator.



 3. In Pop up box enter record manipulator name and record source details.


4.  Double click on newly created manipulator. You will see the below expression editor window.



Now create the expressions as per requirement. Below is the example of expression to create new property based on the value of existing property.

Below algorithm used in this example expression.
if value of Dep_ID property is 123
    then create new property named Location with value Delhi
else if value of Dep_ID property is 456
    then create new property named Location with value Bangalore
else
    then create new property named Location with value Pune 

====================================================================
<EXPRESSION LABEL="" NAME="IF" TYPE="VOID" URL="">

  <EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
    <EXPRNODE NAME="TYPE" VALUE="STRING"/>
    <EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
    <EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
      <EXPRNODE NAME="PROP_NAME" VALUE="Dep_ID"/>
    </EXPRESSION>
    <EXPRESSION LABEL="" NAME="CONST" TYPE="INTEGER" URL="">
      <EXPRNODE NAME="VALUE" VALUE="123"/>
    </EXPRESSION>
  </EXPRESSION>

  <EXPRESSION LABEL="" NAME="CREATE" TYPE="VOID" URL="">
    <EXPRNODE NAME="PROP_NAME" VALUE="Location"/>
    <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
      <EXPRNODE NAME="VALUE" VALUE="Delhi"/>
    </EXPRESSION>
  </EXPRESSION>

  <EXPRNODE NAME="ELSE_IF" VALUE=""/>

  <EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
    <EXPRNODE NAME="TYPE" VALUE="STRING"/>
    <EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
    <EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
      <EXPRNODE NAME="PROP_NAME" VALUE="Dep_ID"/>
    </EXPRESSION>
    <EXPRESSION LABEL="" NAME="CONST" TYPE="INTEGER" URL="">
      <EXPRNODE NAME="VALUE" VALUE="456"/>
    </EXPRESSION>
  </EXPRESSION>

  <EXPRESSION LABEL="" NAME="CREATE" TYPE="VOID" URL="">
    <EXPRNODE NAME="PROP_NAME" VALUE="Location"/>
    <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
      <EXPRNODE NAME="VALUE" VALUE="Bangalore"/>
    </EXPRESSION>
  </EXPRESSION>

  <EXPRNODE NAME="ELSE" VALUE=""/>

  <EXPRESSION LABEL="" NAME="CREATE" TYPE="VOID" URL="">
    <EXPRNODE NAME="PROP_NAME" VALUE="Location"/>
    <EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
      <EXPRNODE NAME="VALUE" VALUE="Pune"/>
    </EXPRESSION>
  </EXPRESSION>

</EXPRESSION>

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

5. Edit other pipeline component to use this manipulator as record source.


6. Save the Endeca project and run the baseline. Below is the example data indexed using configuration.


2 comments:

  1. Hi.
    I am trying to create a String property but it does not working. Can you help me on that.

    Thanks

    ReplyDelete
  2. Hi Neha,

    This is working example.Can you please share your code.

    Thanks

    ReplyDelete