Add(Destination: ICubeModelDestination): ISourceDataImportDestinationInfo;
Add(Destination: Prognoz.Platform.Interop.Cubes.ICubeModelDestination): Prognoz.Platform.Interop.BISearch.ISourceDataImportDestinationInfo;
Destination. Display version of the data source, for which it is necessary to add indexing settings.
The Add method adds indexing settings for the specified display version of data source.
IMPORTANT. Because of the existing features of the Fore language implementation and use of multi-thread indexing mode, indexing with code in the Fore language is not supported. Develop in the Fore.NET language.
Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. The settings for indexing and search in Russian are determined in the repository itself.
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;
//Search and indexing parameters specified 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;
//Indexed object
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 display version
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(0, False);
DimS.SelectElement(1, False);
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. The language used for indexing will be determined in the settings, and one source will be added. A display version 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 keywords must be generated. Calendar dimension is in the list of free dimensions by default that is why it is not processed in code. The required selection will be determined for dimensions. After all settings are determined, indexing will be executed.
See also: