IImportExecutor.Import

Fore.NET Syntax

Import(Context: Prognoz.Platform.Interop.BISearch.ISearchEngineImportContext);

Parameters

Context. Context with indexing parameters.

Description

The Import method indexes data sources.

Comments

On indexing the required documents are created, and indexed data is saved in them where the search service is deployed.

Fore Example

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.

Fore.NET Example

Executing the example requires that the repository contains a parametric standard cube with the STD_CUBE identifier. Two parameters with the YEAR_START and YEAR_FINISH identifiers are created and set up in cube to control nested objects. The settings for indexing and search in Russian are determined in the repository itself.

Imports Prognoz.Platform.Interop.BISearch;
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];
    MObj: IMetabaseObject;
    Cube: ICubeModel;
    ParamValues: IMetabaseObjectParamValues;
    SourceInfo: ISourceDataImportInfo;
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
    MObj := MB.ItemById["STD_CUBE"].Bind();
    Cube := MObj As ICubeModel;
    SourceInfo := ImportContext.SourceInfos.Add(Cube);
    SourceInfo.DestinationInfos.Add(Cube.Destinations.DefaultDestination);
    ParamValues := MObj.Params.CreateEmptyValues();
    ParamValues.FindById("YEAR_START").Value := 2000;
    ParamValues.FindById("YEAR_FINISH").Value := 2010;
    SourceInfo.Params := ParamValues;
    //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. Parameter values, which will be used on opening to get a list of dimension elements, will be determined for the source. After all settings are determined, indexing will be executed. If indexing was already executed for the specified source, the search index will be first cleared for this source.

See also:

IImportExecutor