ISourceDataImportDestinationInfos.Add

Fore Syntax

Add(Destination: ICubeModelDestination): ISourceDataImportDestinationInfo;

Fore.NET Syntax

Add(Destination: Prognoz.Platform.Interop.Cubes.ICubeModelDestination): Prognoz.Platform.Interop.BISearch.ISourceDataImportDestinationInfo;

Parameters

Destination. The displaying option of data source for which it is necessary to add indexing settings.

Description

The Add method adds indexing settings for specified displaying option of data source.

Fore Example

IMPORTANT. Because of the existing features of the Fore language implementation and use of multi-thread mode on indexing, indexing with code on the Fore language is not supported. Develop on the Fore.NET language.

Fore.NET Example

Executing the example requires a standard cube with the identifier STD_CUBE in the repository. In the repository settings for indexing and search in Russian are determined.

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

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    SharedParams: ISharedParams;
    SearchEngine: ISolrSearchEngineService;
    Schema: ISolrSearchEngineSchema;
    ImportExecutor: IImportExecutor;
    ImportContext: ISourceDataImportContext;
    SolrContext: ISolrImportContext;
    Locales: Array = New Integer[1] = [LocaleCodeID.lcidRussian As Integer];
    Cube: ICubeModel;
    CubeDimensions: ICubeModelDimensions;
    CubeDimension: IDimensionModel;
    SourceInfo: ISourceDataImportInfo;
    DestinationInfo: ISourceDataImportDestinationInfo;
    DimSS: IDimSelectionSet;
    DimS: IDimSelection;
    i: Integer;
Begin
    MB := Params.Metabase;
    //Parameters of search and indexing set for repository
    SharedParams := MB.SpecialObject[MetabaseSpecialObject.msoSharedParams].Bind() As ISharedParams;
    SearchEngine := SharedParams.SearchEngine As ISolrSearchEngineService;
    Schema := SearchEngine.SearchEngineSchema As ISolrSearchEngineSchema;
    //Indexing parameters
    Schema.ImportProcessOptions.NeedSmartSearch := False;
    ImportExecutor := Schema.ImportExecutor[SearchEngineTargetType.settSourceData];
    ImportContext := ImportExecutor.CreateContext() As ISourceDataImportContext;
    SolrContext := ImportContext As ISolrImportContext;
    SolrContext.CleanType := SolrImportCleanType.sictSpecified;
    SolrContext.Locales := Locales;
    //Object being indexed
    Cube := MB.ItemById["STD_CUBE"].Bind() As ICubeModel;
    CubeDimensions := Cube.Destinations.DefaultDestination.Dimensions;
    SourceInfo := ImportContext.SourceInfos.Add(Cube);
    DestinationInfo := SourceInfo.DestinationInfos.Add(Cube.Destinations.DefaultDestination);
    //Indexing parameters of displaying option
    DestinationInfo.GroupByDl := True;
    DestinationInfo.ImportMode := SourceImportMode.simFull;
    For i := 0 To CubeDimensions.Count - 1 Do
        CubeDimension := CubeDimensions.Item[i];
        Select Case (CubeDimension As IMetabaseObject).Id
            Case "FACTS": DestinationInfo.FreeDimensions.Add(CubeDimension);
            Case "INDICATORS""COUNTRY": DestinationInfo.KeyWordsDimensions.Add(CubeDimension);
        End Select;
    End For;
    //Set selection by dimensions
    DimSS := DestinationInfo.SelectionSet;
    For Each DimS In DimSS Do
        Select Case DimS.Dimension.Ident
            Case "FACTS""INDICATORS":
                DimS.SelectAll();
            Case "COUNTRY":
                DimS.SelectElement(0False);
                DimS.SelectElement(1False);
        End Select;
    End For;
    //Indexing
    ImportExecutor.Import(ImportContext);
End Sub;

On executing the example the context required for indexing of data source dimension elements will be created. In settings the language used for indexation will be specified and a source will be added. Displaying option will be selected for the source and indexing parameters for different dimensions will be specified: the FACTS dimension will be added to free dimensions, for other dimension it will be specified that key words should be generated. Calendar dimension is in the list of free dimensions by default, that is why it is not processed in code. Required selection will be determined for dimensions. After determination of all settings the indexing will be executed.

See also:

ISourceDataImportDestinationInfos