Adding attributes to search against the index

IBM® Sterling™ Order Management System Software provides the ability to enable indexing of attributes in the entity XML definition.

Starting Release 9.2.1, Order and Shipment entities are enabled for indexing, and most of the commonly-used searchable attributes related to these two entities are marked as indexable in the out-of-the-box entity definition. New attributes can be added to the index definition by extending the entity definition.

For example, you may want to enable the following for indexing:

  • Index the ORDER_TYPE column in the YFS_ORDER_HEADER entity
  • Index the ADDRESS_ID column in the YFS_PERSON_INFO entity
  • Add and index a custom column, such as CUSTOM_NO, in the YFS_ORDER_HEADER entity

To enable indexing, such as for the examples listed above, you need to extend the attribute definition in the entity XML. To associate an attribute to the index:

  1. Locate the entity where the attribute is defined. In the case of an Order index, this must be either the YFS_ORDER_HEADER entity or any one of the entities having a relationship with YFS_ORDER_HEADER. Similarly, for a Shipment index, it must be either the YFS_SHIPMENT entity or any one of the entities having a relationship with YFS_SHIPMENT.
  2. Set the following on the attribute or on the entity relationship, based on the requirement.
    <UsedForIndexing>
       <Index EntityName="<XMLName of the top-level entity of the index>"/>
    </UsedForIndexing>

    Where the top-level entity in the previous example is the YFS_ORDER_HEADER or YFS_SHIPMENT entity.

    For example, to enable the ORDER_TYPE column in the YFS_ORDER_HEADER entity, specify the following:

    <Entity TableName="YFS_ORDER_HEADER">
       <Attribute ColumnName="ORDER_TYPE">
          <UsedForIndexing>
             <Entity EntityName="Order"/>
          </UsedForIndexing>
       </Attribute>
    </Entity>
  3. If the attribute to be indexed belongs to a child entity of the top-level entity, first apply the above UsedForIndexing setting on the entity relationship between the top-level entity and the child entity, and then repeat this for each of the attributes to be indexed on the child entity.

    For example, to enable the indexing of the ADDRESS_ID attribute on an Order's Ship To address, set UsedForIndexing on the relationship between YFS_ORDER_HEADER and YFS_PERSON_INFO, as follows:

    <Entity TableName="YFS_ORDER_HEADER">
       <RelationShips>
          <RelationShip Name="PersonInfoShipTo">
             <UsedForIndexing>
                <Entity EntityName="Order"/>
             </UsedForIndexing>
          </RelationShip>
       </RelationShips>
    </Entity>

    Now, specify a similar setting on the ADDRESS_ID definition.

    <Entity TableName="YFS_PERSON_INFO">
       <Attribute ColumnName="ADDRESS_ID">
          <UsedForIndexing>
             <Entity EntityName="Order"/>
          </UsedForIndexing>
       </Attribute>
    </Entity>

    Similarly, an attribute of the YFS_ORDER_HEADER child’s child entity can also be marked as indexable by setting UsedForIndexing on the entity relationship between the YFS_ORDER_HEADER child and it's child entity.

    Note: One attribute can be associated to more than one index. For example, the DAY_PHONE attribute in YFS_PERSON_INFO can be associated to both the Order and Shipment index, as follows:
    <Attribute ColumnName="DAY_PHONE">
       <UsedForIndexing>
          <Entity EntityName="Order"/>
          <Entity EntityName="Shipment"/>
       </UsedForIndexing>
    </Attribute>
    Note: Sterling Order Management System Software does not support the indexing of derived attributes. Only the attributes (including the VIRTUAL attributes) defined in the entity XML definition can be marked as indexable.
  4. Build and deploy your extensions to update the system with your extensions. Refer to Extending Database Tables in Sterling Selling and Fulfillment Foundation: Extending the Database for information about extending entity definitions.
  5. After you have deployed your extensions, execute the steps described in Updating elasticsearch server index mappings with custom extensions.