ISolrImportAttributeFieldBinding.Dimension

Fore Syntax

Dimension: IDimensionModel;

Fore.NET Syntax

Dimension: Prognoz.Platform.Interop.BISearch.IDimensionModel;

Description

The Dimension property determines the data source dimension, to which attribute binding is made.

Fore Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINER identifier. The first task in the container is used to refresh search index. Indexing parameters for standard cube are determined in the task settings. The TAG custom field is created in indexing settings and repository search.

Sub UserProc;
Var
    MB: IMetabase;
    Container: IScheduledTasksContainer;
    Task: ISearchEngineImportScheduledTask;
    EngineSchema: ISolrSearchEngineSchema;
    ImportContext: ISourceDataImportContext;
    Cube: ICubeModel;
    CubeDimensions: ICubeModelDimensions;
    Dimension: IDimensionModel;
    SourceInfo: ISourceDataImportInfo;
    DestinationInfo: ISourceDataImportDestinationInfo;
    FieldBindings: ISolrImportFieldBindings;
    FieldBinding: ISolrImportAttributeFieldBinding;
    Field: ISolrField;
Begin
    MB := MetabaseClass.Active;
    //Get task
    Container := MB.ItemById("TASK_CONTAINER").Bind As IScheduledTasksContainer;
    Task := Container.Tasks.Item(0).Edit As ISearchEngineImportScheduledTask;
    //Context to index objects
    EngineSchema := Task.Engine.SearchEngineSchema As ISolrSearchEngineSchema;
    ImportContext := Task.ImportContext(SearchEngineTargetType.SourceData) As ISourceDataImportContext;
    //Get cube indexing parameters
    SourceInfo := ImportContext.SourceInfos.Item(0);
    DestinationInfo := SourceInfo.DestinationInfos.Item(0);
    Cube := MB.Item(SourceInfo.Key).Bind As ICubeModel;
    CubeDimensions := Cube.Destinations.DefaultDestination.Dimensions;
    Dimension := CubeDimensions.FindById("COUNTRY");
    //Parameters of filling in custom fields
    FieldBindings := (DestinationInfo As ISolrSourceDataImportDestinationInfo).FieldBindings;
    //Field, for which parameters will be set
    Field := EngineSchema.Fields(SearchEngineTargetType.SourceData).FindById("TAG");
    //Fill in from dimension attribute values
    FieldBinding := FieldBindings.AddBinding(SolrFieldBindingType.ByAttribute, Field) As ISolrImportAttributeFieldBinding;
    FieldBinding.Dimension := Dimension;
    FieldBinding.Attribute := Dimension.Attributes.FindById("NAME");
    //Install context to task
    Task.ImportContext(SearchEngineTargetType.SourceData) := ImportContext;
    //Save task
    (Task As IMetabaseObject).Save;
End Sub UserProc;

On executing the example settings parameters of the TAG custom field values will be set: values of the NAME property of the COUNTRY dimension will be set as field values.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.BISearch;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.KeFore;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Container: IScheduledTasksContainer;
    Task: ISearchEngineImportScheduledTask;
    EngineSchema: ISolrSearchEngineSchema;
    ImportContext: ISourceDataImportContext;
    Cube: ICubeModel;
    CubeDimensions: ICubeModelDimensions;
    Dimension: IDimensionModel;
    SourceInfo: ISourceDataImportInfo;
    DestinationInfo: ISourceDataImportDestinationInfo;
    FieldBindings: ISolrImportFieldBindings;
    FieldBinding: ISolrImportAttributeFieldBinding;
    Field: ISolrField;
Begin
    MB := Params.Metabase;
    //Get task
    Container := MB.ItemById["TASK_CONTAINER"].Bind() As IScheduledTasksContainer;
    Task := Container.Tasks.Item[0].Edit() As ISearchEngineImportScheduledTask;
    //Context to index objects
    EngineSchema := Task.Engine.SearchEngineSchema As ISolrSearchEngineSchema;
    ImportContext := Task.ImportContext[SearchEngineTargetType.settSourceData] As ISourceDataImportContext;
    //Get cube indexing parameters
    SourceInfo := ImportContext.SourceInfos.Item[0];
    DestinationInfo := SourceInfo.DestinationInfos.Item[0];
    Cube := MB.Item[SourceInfo.Key].Bind() As ICubeModel;
    CubeDimensions := Cube.Destinations.DefaultDestination.Dimensions;
    Dimension := CubeDimensions.FindById("COUNTRY");
    //Parameters of filling in custom fields
    FieldBindings := (DestinationInfo As ISolrSourceDataImportDestinationInfo).FieldBindings;
    //Field, for which parameters will be set
    Field := EngineSchema.Fields[SearchEngineTargetType.settSourceData].FindById("TAG");
    //Fill in from dimension attribute values
    FieldBinding := FieldBindings.AddBinding(SolrFieldBindingType.sfbtByAttribute, Field) As ISolrImportAttributeFieldBinding;
    FieldBinding.Dimension := Dimension;
    FieldBinding.Attribute := Dimension.Attributes.FindById("NAME");
    //Install context to task
    Task.ImportContext[SearchEngineTargetType.settSourceData] := ImportContext;
    //Save task
    (Task As IMetabaseObject).Save();
End Sub;

See also:

ISolrImportAttributeFieldBinding | System and Custom Fields