When you perform searches, you may want to sort your search results by a specific criterion. The criterion you select must be indexed before it can be used to sort search results. If the existing index does not contain the property that you want to use for sorting, you must add it. The following section provides information on how to add a property to an index.

The IndexingOutputConfig component is defined using the following properties:

For example, the /atg/commerce/search/OrderOutputConfig component has the following configuration, which can be accessed using the Dynamo Server Admin:

definitionFile=/atg/commerce/search/order-output-config.xml
repository=/atg/commerce/order/OrderRepository

The /atg/userprofiling/search/ProfileOutputConfig component has the following configuration, which can be accessed using the Dynamo Server Admin:

definitionFile=/atg/userprofiling/search/profile-output-config.xml
repository=/atg/userprofiling/ProfileAdapterRepository

For detailed information on modifying IndexingOutputConfig components, refer to the Configuring Remote Indexing Engines section in the ATG Search Installation and Configuration Guide.

Working with Definition Files

You add properties to be indexed by appending them to the definition file associated with the component. The definition file starts by identifying a top-level item element that specifies the item-descriptor to use, and then lists the properties of that item type to include within the index. The properties appear as property elements within a meta-properties element.

When you specify a meta property in the definition file, you can use the store-as-meta-index Boolean attributes to specify how to structure the index. If set to true, the value of the property is used as a key in a lookup table, which enables faster retrieval of the document.

For example, the following is a portion of the ProfileOutputConfig definition file:

<item item-descriptor-name="user" is-document="true">
  <title property-name="login"/>
  <meta-properties>
    <property name="$repositoryId" type="string"/>
    <property name="$url" type="string"/>
    <property name="$baseUrl" type="string" suppress="true"/>
    <property name="$itemDescriptor.itemDescriptorName" type="string"
        suppress="true"/>
    <property name="$repository.repositoryName" type="string"
        suppress="true"/>
    <property name="login" type="string" store-as-meta-index="true"/>
    <property name="email" type="string" store-as-meta-index="true"/>
    <property name="firstName" type="enum" store-as-meta-index="true"/>
    <property name="lastName" type="string" store-as-meta-index="true"/>
  </meta-properties>
</item>

Using the above example, the ProfileOutputConfig component is configured by default to use store-as-meta-index for the email property of the login item. Since each e-mail value is unique, if a query includes an exact match “starts with” constraint that specifies the email value, the correct profile is retrieved without having to search the entire index. Properties that should be displayed in a results list, or that you want to use to sort the results, should set the store-as-meta-index="true" attribute.

Extending the Definition File

To index additional order or profile properties, extend the definition file associated with the IndexingOutputConfig component using xml-combine.

By adding a new definition file that contains the same nucleus path to your customization directory, you can layer new property information onto the existing IndexingOutputConfig component definition file.

For example, you can create a /liveconfig /atg/userprofiling/search/profile-output-
config.xml
file that appends the default /atg/userprofiling/search/profile-output-
config.xml
file by adding the middleName property to the index:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE item PUBLIC //DTD RepositoryOuput Specifier 1.0//EN"
"http://www.atg.com/dtds/search/indexing-dependency-schema.dtd">

<!—Indexing Schema for External Profiles
   XML combines to append the middleName property to the index
-->

<item item-descriptor-name="user" >
  <meta-properties>
    <property name="middleName" type="string" store-as-meta-index="true"/>
  </meta-properties>
</item>

When you build your customization module, the system will run xml-combine and combine these files into one file. Note that you do not need to explicitly set the xml-combine attribute. By default, the contents of the tag in the second file are appended to the contents of the tag in the first file. Refer to the ATG Platform Programming Guide for information on combining XML files.

Once you have rebuilt your customization module, invoke the bulkLoad method on the IndexingOutputConfig component. You can then review the ProfileOutputConfig component’s definition file in the Dynamo Server Admin. The definition file will display the XML value after the combination of the two XML files.

Using the previous examples, the definition file of the ProfileOutputConfig component now contains the default properties, as well as the custom middleName property you created in your customization module.

Note: The following is an example that contains modified path names for demonstration purposes:

Profile Output Configuration Example

Once you have added a property to an index, it can now be used to sort search results. The following sections provide examples on creating the UI elements needed to create sorted search results.


Copyright © 1997, 2012 Oracle and/or its affiliates. All rights reserved. Legal Notices