ISolrImportDocumentExtensionBinding.Element

Fore Syntax

Element: Integer;

Fore.NET Syntax

Element: Integer;

Description

The Element property determines an index of the element, which data will be placed as custom attribute values.

Comments

The dimension is set in the ISolrImportDocumentExtensionInfo.Dimension property.

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 and repository search settings. The repository also contains a cube with the STD_ALTERNATIVE_DATA identifier, which structure corresponds to the indexed cube and also contains the ADDITIONAL_FACTORS additional dimension.

Sub UserProc;
Var
    MB: IMetabase;
    Container: IScheduledTasksContainer;
    Task: ISearchEngineImportScheduledTask;
    EngineSchema: ISolrSearchEngineSchema;
    ImportContext: ISourceDataImportContext;
    Cube: ICubeModel;
    CubeDimensions: ICubeModelDimensions;
    Dimension: IDimensionModel;
    SourceInfo: ISourceDataImportInfo;
    DestinationInfo: ISourceDataImportDestinationInfo;
    ExtensionInfo: ISolrImportDocumentExtensionInfo;
    FieldBindings: ISolrImportFieldBindings;
    FieldBinding: ISolrImportDocumentExtensionBinding;
    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);
    //Parameters of filling in custom fields
    ExtensionInfo := (DestinationInfo As ISolrSourceDataImportDestinationInfo).DocumentExtensionInfo;
    Cube := MB.ItemById("STD_ALTERNATIVE_DATA").Bind As ICubeModel;
    CubeDimensions := Cube.Destinations.DefaultDestination.Dimensions;
    Dimension := CubeDimensions.FindById("ADDITIONAL_FACTORS");
    ExtensionInfo.Cube := Cube;
    ExtensionInfo.Dimension := Dimension;
    FieldBindings := (DestinationInfo As ISolrSourceDataImportDestinationInfo).FieldBindings;
    //Field, for which parameters will be set
    Field := EngineSchema.Fields(SearchEngineTargetType.SourceData).FindById("TAG");
    //Fill in from values by specified dimension elements of external data source
    FieldBinding := FieldBindings.AddBinding(SolrFieldBindingType.ByDocumentExtension, Field) As ISolrImportDocumentExtensionBinding;
    FieldBinding.Element := 0;
    //Install context to task
    Task.ImportContext(SearchEngineTargetType.SourceData) := ImportContext;
    //Save task
    (Task As IMetabaseObject).Save;
End Sub UserProc;

On executing the example parameters of the TAG custom field filling in will be set up in the task: values by specified element of external data source will be placed as field values. The external data source will be determined previously.

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;
    ExtensionInfo: ISolrImportDocumentExtensionInfo;
    FieldBindings: ISolrImportFieldBindings;
    FieldBinding: ISolrImportDocumentExtensionBinding;
    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];
    //Parameters of filling in custom fields
    ExtensionInfo := (DestinationInfo As ISolrSourceDataImportDestinationInfo).DocumentExtensionInfo;
    Cube := MB.ItemById["STD_ALTERNATIVE_DATA"].Bind() As ICubeModel;
    CubeDimensions := Cube.Destinations.DefaultDestination.Dimensions;
    Dimension := CubeDimensions.FindById("ADDITIONAL_FACTORS");
    ExtensionInfo.Cube := Cube;
    ExtensionInfo.Dimension := Dimension;
    FieldBindings := (DestinationInfo As ISolrSourceDataImportDestinationInfo).FieldBindings;
    //Field, for which parameters will be set
    Field := EngineSchema.Fields[SearchEngineTargetType.settSourceData].FindById("TAG");
    //Fill in from values by specified dimension elements of external data source
    FieldBinding := FieldBindings.AddBinding(SolrFieldBindingType.sfbtByDocumentExtension, Field) As ISolrImportDocumentExtensionBinding;
    FieldBinding.Element := 0;
    //Install context to task
    Task.ImportContext[SearchEngineTargetType.settSourceData] := ImportContext;
    //Save task
    (Task As IMetabaseObject).Save();
End Sub;

See also:

ISolrImportDocumentExtensionBinding | System and Custom Fields