Configuring parent and child data sources

Studio data sources can have parents and children. A child data source is essentially a subset of its parent data source.

For example, a parent data source contains all of the transaction records for a company. A child data source may contain only transactions from the United States.

Child data sources may themselves have children. For example, the child data source containing United States transactions may have a child data source that contains only transactions for New York, or transactions processed by a specific distributor.

You can configure whether refinements to related data sources affect the current data source.

Creating a child data source

A child data source usually has the same server, port, and data domain name as its parent data source.

Note: You cannot configure different attribute groups for data sources that have the same host, port, and data domain name. They are simply different views of the same source data, and any change to the attribute groups in one data source automatically updates the groups in the other data source.
To identify the data source as a child data source, and also identify its parent, you add the following setting to the data source definition:
Setting Description
parentDataSource The id of the parent data source.

You then configure baseFunctions setting with the filters for the child data source.

Default effect of query state changes on parent and child data sources

By default, the current query state for a child data source is the current query state of the parent data source plus any filters from the child data source. For example, if the parent data source has been refined to only include transactions for 1999, then the child data source only includes transactions for the United States (the child data source filter) from 1999 (the parent data source refinement).

Changes to the query state for any data source are applied to the entire family hierarchy that the data source belongs to:
  • Changes to the query state for a child data source are applied to its parent data source.

    For example, if an end user selects a refinement from a Guided Navigation component that is bound to a child data source, components bound to the parent data source also are updated with that refinement.

    If that parent data source is itself a child data source, the change is then applied to its parent as well.

    The operation is applied to each parent in turn until it reaches a data source that does not have a parent.

  • Changes to the query state for a parent data source are applied to all of its children.

    If that child data source itself has children, the change is then applied to those children as well.

    The operation is applied to each child in turn until it reaches a data source that does not have any children.

For example, for the following data source hierarchy:

Diagram showing a hierarchy of parent, child, and grandchild data sources
  • If an end user refines Parent1 to only show transactions for 1999:
    1. Child1 and Child2 are refined to only show transactions for 1999, plus their original base filters.
    2. The refinement to Child1 causes Grandchild1 to be refined to only show transactions for 1999, plus its original base filters and the filters from Child1.
  • If an end user refines Child1 to only show credit card transactions:
    1. Parent1 and Grandchild1 are refined to only show credit card transactions, plus their original filters.
    2. The refinement to Parent1 causes Child2 to be refined to only show credit card transactions, plus its original base filters.
  • If an end user refines Grandchild1 to only show cash transactions:
    1. Child1 is refined to only show cash transactions, plus its original base filters.
    2. The refinement to Child1 causes Parent1 to be refined to only show cash transactions, plus any original filters.
    3. The refinement to Parent1 causes Child2 to be refined to only show cash transactions, plus its original base filters.

Configuring selective refinement for the data source

For a data source with related data sources, you can use selective refinement to override the default refinement behavior. Selective refinement allows you to control how refinements to related data sources affect the current data source.

The minimum configuration is to enable selective refinement. If you enable selective refinement, then a refinement to a related data source only affects the current data source if the attribute used for the refinement is present in both data sources.

You can configure the selective refinement to use a regular expression to select the attributes to include. You can also exclude and include specific attributes.

To implement selective refinement, you add the selectiveRefinements setting to the data source definition. The selectiveRefinements setting can use the following parameters:

selectRefinements Parameter Description
enabled Required. Whether to enable selective refinements.

If set to true, then a refinement to a related data source is only applied to the current data source if the attribute used for the refinement is present in both data sources.

If set to false (the default), then all refinements from related data sources are applied to the current data source.

autoDetect Required. Whether to automatically detect the attributes to use for refinement.

If set to true (the default), then the attributes are detected automatically.

You can also use autoDetectPattern to create a regular expression for detecting the attributes for which to apply refinements.

If set to false, then the only attributes used for refinement are those provided by the includedAttributes parameter.

autoDetectPattern A regular expression used to determine the attributes for which to respect refinements from related data sources.

For example, setting this to "^Supplier.+" indicates to only respect refinements from attributes whose attribute keys start with "Supplier".

excludedAttributes Optional. A comma-separated list of attributes for which to ignore refinements from related data sources.

When specifying the attributes, use the attribute key.

For example, the following configuration excludes refinements by color and sleeve type:

 "selectiveRefinements":{
    "enabled":true,
    "excludedAttributes":["Color","Sleeve_Type"]
  }
includedAttributes Optional. A comma-separated list of attributes for which to respect refinements.

When specifying the attributes, use the attribute key.

If autoDetect is false, then if you do not provide attributes here, Studio does not apply any refinements from related data sources.

If you are using autoDetectPattern to detect attributes, then the attributes provided here are used in addition to the automatically detected ones.

For example, the following configuration adds refinement by price and region to the automatically detected attributes:

 "selectiveRefinements":{
    "enabled":true,
    "autoDetectPattern":"Customer.+",
    "includedAttributes":["Price","Sales_Region"]
  }
Note that if the attributes in the Endeca Server data domain are changed, the change may not be immediately reflected in the cached selective refinements configuration. To make sure that the selective refinement configuration is current, either:
  • Update the configuration to edit the specific included and excluded attributes
  • If the attributes are detected automatically, then manually edit and save the data source configuration. You do not need to actually make any changes. Clicking Save on the Data Source Definition dialog forces Studio to recalculate the attributes to include.

Example of a child data source

In the following example of a child data source, the ID of the parent data source is all-transactions.

This child data source includes data from all-transactions, filtered to only include records for the Importer supplier type.

The selective refinement indicates to respect customer-related attributes, except for the customer discount, and adds sales region and sales rep to the respected refinements.

{
 "server":"server01.lab.acme.com",
 "port":"5555",
 "dataDomainName":"acmeDB"
 "name":"Importer Transactions"
 "parentDataSource":"all-transactions",
 "baseFunctions": [
  {"class":"com.endeca.portal.data.functions.DataSourceFilter",
   "filterString":"Supplier_Types='Importer'"
  }
 ]
 "selectiveRefinements":{
    "enabled":true,
    "autoDetect":true,
    "autoDetectPattern":"^Customer.+",
    "includedAttributes":["Sales_Region","Sales_Rep"],
    "excludedAttributes":["Customer_Discount"]
  }  
}